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

Clang: "no_keywords" in .pro file leads to "could not parse included file" in Qt headers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 4.2.1
    • Qt Creator 4.1.0, Qt Creator 4.2.0-rc1
    • C/C++/Obj-C++ Support
    • None
    • Win 7 64bit, Qt 5.6, Qt Creator 4.1 final and 4.2-rc1 32bit (official .exe installer from qt.io), Clang code model

    Description

      The situation is a QMake project where CONFIG += no_keywords is set (see attached no_keywords_bug.zip for a minimal example project). The main.cpp file includes QObject, which makes the Clang codemodel in Qt Creator 4.2-rc1 complain (see attached error1.png):

      The code model could not parse an included file, which might lead to slow or incorrect codecompletion … qobject.h:424:7

      The resp. line in Qt 5.6 qobject.h reads:

      public Q_SLOTS:

      The code model marks this line as an error and the tooltip says (see error2.png):

      error. unknown type name 'slots' … expanded from macro 'Q_SLOTS'

      In Creator 4.1 a Ctrl+Click on Q_SLOTS in that line jumps to the empty Q_SLOTS definition in qobjectdefs.h:71 as expected. In Creator 4.2 the same Ctrl+Click is disabled.

      When I remove the "no_keywords" from the project config the problem disappears.

      Qt Creator 4.1 shows the same error in qobject.h, but nothing in main.pp (since I guess those error popups are new; they’re a great feature btw).

      Compilation (tried with GCC and Clang) succeeds without any warnings or errors.

      Attachments

        1. error1.png
          error1.png
          39 kB
        2. error2.png
          error2.png
          33 kB
        3. no_keywords_bug.zip
          0.5 kB
        For Gerrit Dashboard: QTCREATORBUG-17371
        # Subject Branch Project Status CR V

        Activity

          People

            kosjar Nikolai Kosjar
            besc besc
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes