Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26866

Clang code model doesn't handle precompiled headers properly

    XMLWordPrintable

Details

    • Windows

    Description

      I'm using QtC built from master (37718e3874) on Windows 10 with visual studio 2022 (updated last week).

      Compared to QtC 6.0.1, the clang code model seems to have a problem parsing header files that are included from the precompiled header file when PCH is enabled. I can reproduce this using a self-compiled build of Qt 6.2 from a few months ago. I haven't yet tried a more recent build of Qt. If you think that matters let me know and I will try to update.

      To reproduce, open the attached project in QtC. If I open test.h, I get the following warnings in a yellow box at the top of the document editor:

      pch.h:1:10: error: main file cannot be included recursively when building a preamble
      405:10: note: in file included from <built-in>:405:
      [Source: libclang]
      
      

      If I open test.pro and comment out the following two lines, save it, and then give the code model a few seconds to update, the warning goes away:

      #CONFIG += precompile_header
      #PRECOMPILED_HEADER = pch.h
      

      If I uncomment those two lines, save, and wait a few seconds, the warning returns.

       

      In the Code Model tab of Settings/C++, I have none of the check boxes checked and the clang code model is enabled. The warnings are the default for the build system.

      Attachments

        Activity

          People

            kandeler Christian Kandeler
            aclight Adam Light
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: