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

Include paths specified with -iquote are not considered in the C++ code model

    XMLWordPrintable

Details

    • b6adaab3ea (qt-creator/qt-creator/8.0) b6adaab3ea (qt-creator/qt-creator/master) b6adaab3ea (qt-creator/tqtc-qt-creator/8.0)

    Description

      When using quoted include paths like #include "a/b.h" in combination with the compiler flag -iquote a the include path is ignored by the C++ code model of QTCreator. I think this is the problematic code place where -iquote is missing. -iquote is a valid command line argument for Clang: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-iquote-directory

      This is a minimal reproducer:
       

      $ mkdir -p /home/user/bug/a
      $ touch /home/user/bug/a/b.h
      $ mkdir -p /home/user/bug/c
      $ cat /home/user/bug/c/main.cpp
      #include "a/b.h"
      int main()
      {
          return 0;
      }
      $ cat /home/user/bug/compile_commands.json
      [
      {"command":"/usr/bin/gcc -iquote /home/user/bug -c main.cpp","directory":"/home/user/bug/c","file":"main.cpp"}
      ]
      

      After loading the project in the editor a "file not found" error is reported by the code model.

      Replacing -iquote in the compile_commands.json with -I or -isystem makes the code model valid. Using "Inspect C++ CodeModel..."  reveals that with -iquote the path is missing and when using -I or -isystem the path is added as a type UserPath.

       

       

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-22949
        # Subject Branch Project Status CR V

        Activity

          People

            kandeler Christian Kandeler
            jerryct Jerry Crunchtime
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes