-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Switch to using -p for clang-tidy when configured by compileCommands #8740
Comments
Edit: It's still not solved by this workaround, see next comment. I figured this out. In order to fix this, you need to pass These can be found out by using the following command: Still, it's unclear to me why the command line command worked in the first place. I don't consider this fixed. |
You can see the command line we run via looking at the logging with C_Cpp.loggingLevel set to "Debug". |
We were incorrectly removing a bunch of system defines, including The fix should be in our next Insiders later this week. UPDATE: The insiders got delayed. |
The fix for this issue is now available in version Insiders 1.9.0. |
I just tested it with 1.9.1, still got the same issue when working with standard template library headers. The problem with the minimal header of my first comment (error_header.h) is now fixed though. Command line output (working as expected):
Also see the output of the C++ vscode extension when running code analysis: |
I tried to find out more information about this problem and came to the following conclusion:
Why are these many defines and includes appended to the command line invocation of clang-tidy anyway? As you can see in my previous comments, running clang-tidy with only the -p option and without any additional includes / defines, the output is correct. Can't you just invoke clang-tidy like that? |
I recall it was simpler to just query IntelliSense for its info (which it already parsed from compile commands) regardless of whether it was configured by a compile commands or configuration provider or c_cpp_properties.json instead of trying to get the compile_commands directly, which would require more work and we weren't aware of any reason to do that additional work. I can look into switching to using -p in the compile commands scenario. |
Thank you so much, my team is really looking forward to using clang-tidy, so your work on this is highly appreciated. Please also notice that currently vscode is not correctly replacing the command variable ( ${command:cmake.buildDirectory} ) in the clang-tidy invocation (clang-tidy-bug.txt, line 5). |
I filed an issue about the command resolving at #8946. |
I have just tested the new options in the v1.10.0 pre-release and am happy to report that clang-tidy is now working properly in our codebase. The only issue we are still facing at the moment is that for the Thanks again for your effort. |
Bug type: Language Service
Describe the bug
In my project I'm using the cmsis_compiler.h header which checks for the compiler used.
A minimal example of the problematic header looks like this:
I'm compiling with the GNU arm-none-eabi toolchain, so
__GNUC__
is defined.When I include this header in a source file, some warnings, which were previously shown in the editor, are now not shown anymore. See the following two pictures:
//test.cpp
However, if i manually invoke clang-tidy from the command line (same arguments as set in setting.json), all warnings are shown like in the first picture:
Relevant section of settings.json:
The build folder contains a
compile_commands.json
which, to my understanding, is used in either case (command line and by vscode).It has to do something with the conditional #error directive.
If my problematic header just contains #error without a condition, the command line invocation of clang-tidy does also not display all warnings.
It seems to me that vscode is invoking clang-tidy differently than my command.
Is there any way to see what exact command vscode is calling to invoke clang tidy?
The text was updated successfully, but these errors were encountered: