[Qt-creator] clangd/clang-tidy give errors but MSVC doesn't

Adam Light aclight at gmail.com
Wed Sep 27 18:43:25 CEST 2023


Hi

If I compile my cmake-based project from Qt Creator 11.0.2 on Windows using
the build tools that come with MS Visual Studio 2022, the project compiles
without errors or warnings emitted. However, if I run clang-tidy on the
entire project, there are quite a few files that cannot be processed due to
compile errors in the file. If I open those files with errors in Creator, I
see the red circle in the margin, indicating an error, on the same lines
that clang-tidy complains about.

Clearly clangd/clang-tidy and MSVC are doing something different if the
compile is successful only in MSVC, but I can't figure out why that would
be.

In the QtC global settings for clangd, I have "Build-system warnings"
selected for Diagnostic configuration. In the project settings for this
project, "Use global settings" is checked for everything, including Clang
Tools and clangd. I am using the default clangd and clang-tidy executables
that ship with QtC.

We are suppressing quite a few warnings in our CMakeLists.txt files, and
the command lines I see for clang-tidy.exe don't have corresponding -Wno...
flags, so maybe that's the problem. If so, it's not clear to me how to work
around this, especially since I have "Build-system warnings" selected for
clangd diagnostics.

Thanks for any ideas

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20230927/86cfc780/attachment.htm>


More information about the Qt-creator mailing list