-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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] Not possible to disable specific clang-analyzer checks #59588
Comments
@llvm/issue-subscribers-bug |
@llvm/issue-subscribers-clang-tidy |
They can be disabled as a whole via |
Yep. I do want to disable only specific checks that are problematic/have false positives, not all of them... Could it be the dots in the name of the check which is the problem? The other checks don't have dots in the name. |
If I add
So the check is enabled in the binary, not via |
Digging deep into the code, I find: // Always add all core checkers if any other static analyzer check is enabled.
// This is currently necessary, as other path sensitive checks rely on the
// core checkers. I don't quite understand the comment. What are |
That appears to be a certain type of static analyzer check - hence https://github.com/llvm/llvm-project/tree/main/clang/include/clang/StaticAnalyzer/Core/PathSensitive. |
@haoNoQ Do you have any insight as to why // List all static analyzer checkers that our filter enables.
//
// Always add all core checkers if any other static analyzer check is enabled.
// This is currently necessary, as other path sensitive checks rely on the
// core checkers.
for (StringRef CheckName : RegisteredCheckers) {
std::string ClangTidyCheckName((AnalyzerCheckNamePrefix + CheckName).str());
if (CheckName.startswith("core") ||
Context.isCheckEnabled(ClangTidyCheckName)) {
List.emplace_back(std::string(CheckName), true);
}
} |
This was first introduced around 10 years ago here. I don't see many details in the commit message to tell what exactly is it that was failing in the past that needed this to be added. @r4nt do you recall? Is this comment valid today? If I were to remove it, how can I test that things still work as expected? |
Running clang-tidy as:
Displays:
This behavior does not happen on other checks.
The text was updated successfully, but these errors were encountered: