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

Adam Light aclight at gmail.com
Fri Sep 29 21:09:08 CEST 2023


OK, thanks. I've created a bug report at
https://bugreports.qt.io/browse/QTCREATORBUG-29676.

Adam

On Wed, Sep 27, 2023 at 11:38 PM Eike Ziller <Eike.Ziller at qt.io> wrote:

> Hi,
>
> unfortunately building with MSVC and feeding Clangd with information are
> different processes.
> The former one is just telling CMake to do its stuff based on the CMake
> project files, but we cannot do the same for Clangd or clang-tidy.
> CMake gives us information about the flags that it passes to MSVC, but it
> complicates things that Clang and MSVC have different interfaces.
>
> Qt Creator generates <build>/.qtc_clangd/compile_commands.json for Clang,
> from the information from CMake given via .cmake/api/v1/reply/, and some
> information can also be inspected via Tools > Debug Qt Creator > Inspect
> C++ Code Model.
>
> The best would be to create a bug report with information on which flags
> go missing and other details.
>
> Br, Eike
>
> > Am 27.09.2023 um 18:43 schrieb Adam Light <aclight at gmail.com>:
> >
> > 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
> > --
> > Qt-creator mailing list
> > Qt-creator at qt-project.org
> > https://lists.qt-project.org/listinfo/qt-creator
>
> --
> Eike Ziller
> Principal Software Engineer
>
> The Qt Company GmbH
> Erich-Thilo-Str. 10
> 12489 Berlin, Germany
> eike.ziller at qt.io
> https://qt.io
>
> Geschäftsführer: Mika Pälsi,
> Juha Varelius, Jouni Lintunen
> Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20230929/ddc3f7a6/attachment.htm>


More information about the Qt-creator mailing list