Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-tidy] Fix [File|Config]OptionsProvider::getOptions #134502

Open
carlosgalvezp opened this issue Apr 5, 2025 · 2 comments
Open

[clang-tidy] Fix [File|Config]OptionsProvider::getOptions #134502

carlosgalvezp opened this issue Apr 5, 2025 · 2 comments
Assignees

Comments

@carlosgalvezp
Copy link
Contributor

#121323 changed the way the absolute path is computed.
This led to HeaderFilterRegex not picked up from the .clang-tidy file sitting at the current working directory. This has partially been fixed by #133582, but nevertheless this should be fixed here as well.

Before the PR:

Getting options for file ''
AbsolutePath: /path/to/root/

After the PR:

Getting options for file ''
AbsolutePath: /path/to/root

I.e. there is a missing trailing slash. This makes the addRawFileOptions no longer work, because it does this:

  StringRef RootPath = llvm::sys::path::parent_path(AbsolutePath);

Since the AbsolutePath no longer has a slash, instead of picking /path/to/root as RootPath, it picks /path/to, and there is no .clang-tidy file there.

@carlosgalvezp
Copy link
Contributor Author

FYI @HerrCai0907

@llvmbot
Copy link
Member

llvmbot commented Apr 5, 2025

@llvm/issue-subscribers-clang-tidy

Author: Carlos Galvez (carlosgalvezp)

https://github.com//pull/121323 changed the way the absolute path is computed. This led to `HeaderFilterRegex` not picked up from the `.clang-tidy` file sitting at the current working directory. This has partially been fixed by https://github.com//pull/133582, but nevertheless this should be fixed here as well.

Before the PR:

Getting options for file ''
AbsolutePath: /path/to/root/

After the PR:

Getting options for file ''
AbsolutePath: /path/to/root

I.e. there is a missing trailing slash. This makes the addRawFileOptions no longer work, because it does this:

  StringRef RootPath = llvm::sys::path::parent_path(AbsolutePath);

Since the AbsolutePath no longer has a slash, instead of picking /path/to/root as RootPath, it picks /path/to, and there is no .clang-tidy file there.

@HerrCai0907 HerrCai0907 self-assigned this Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants