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-16 cannot disable clang-analyzer-core checks #61520

Closed
kiwixz opened this issue Mar 19, 2023 · 6 comments
Closed

clang-tidy-16 cannot disable clang-analyzer-core checks #61520

kiwixz opened this issue Mar 19, 2023 · 6 comments

Comments

@kiwixz
Copy link

kiwixz commented Mar 19, 2023

It used to work with LLVM 15.

An example working as expected with another check:

$ clang-tidy-16 --checks=* --list-checks | grep NewDelete          
    clang-analyzer-cplusplus.NewDelete
    clang-analyzer-cplusplus.NewDeleteLeaks
$ clang-tidy-16 --checks=*,-clang-analyzer-cplusplus.NewDelete --list-checks | grep NewDelete     
    clang-analyzer-cplusplus.NewDeleteLeaks

An example of a problematic check:

$ clang-tidy-16 --checks=* --list-checks | grep CallAndMessage 
    clang-analyzer-core.CallAndMessage
    clang-analyzer-core.CallAndMessageModeling
$ clang-tidy-16 --checks=*,-clang-analyzer-core.CallAndMessage --list-checks | grep CallAndMessage
    clang-analyzer-core.CallAndMessage
    clang-analyzer-core.CallAndMessageModeling
@firewave
Copy link

Related to #59588 and #59589

@llvmbot
Copy link
Member

llvmbot commented Mar 19, 2023

@llvm/issue-subscribers-clang-tidy

@PiotrZSL
Copy link
Member

PiotrZSL commented Mar 19, 2023

To be honest that dependency on core checks is not needed at all.
Thing is that clang/include/clang/StaticAnalyzer/Checkers/Checkers.td define list of checks, their dependences and what are hidden and what are not. Clang-tidy just don't use this information and follow simple aproach.
I will see what I can do...

@PiotrZSL
Copy link
Member

May "help": https://reviews.llvm.org/D146396
But I wouldn't expect it to land into Clang 16, but free to do cherry-pick.

@kiwixz
Copy link
Author

kiwixz commented Mar 21, 2023

The thing is that it used to work with LLVM 15. As I understand, clang-tidy force-enables the checks but filters the warnings at the end. I think your patch will definitely improve speed by not running unneeded checks, but we still want to ensure the filter is working.

I narrowed the regression to a specific condition, it only happens when treating warnings as errors.

Submitted a fix here: https://reviews.llvm.org/D146520

@kiwixz
Copy link
Author

kiwixz commented Jul 22, 2023

Fixed with 9644368

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

5 participants