Qt5/Mac header finding in KDevelop5 (clang parser??)

René J.V. Bertin rjvbertin at gmail.com
Tue Jun 21 08:07:36 UTC 2016


On Monday June 20 2016 17:29:20 Aleix Pol wrote:

>> - why does -isystem /path/to/QtCore.framework/Headers not enable resolving e.g. `#include <QCoreApplication>` given that /path/to/QtCore.framework/Headers contains both QCoreApplication and qcoreapplication.h ?
>That will be much easier to understand when we have a test.

I did a search on isystem over both kdevelop and kdevplatform, and saw this, in languages/clang/duchain/parsesession.cpp:


    if (hasQtIncludes(includes.system)) {
        const auto wrappedQtHeaders = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
                                                             QStringLiteral("kdevclangsupport/wrappedQtHeaders"),
                                                             QStandardPaths::LocateDirectory).toUtf8();
        if (!wrappedQtHeaders.isEmpty()) {
            smartArgs << wrappedQtHeaders;
            clangArguments << "-isystem" << wrappedQtHeaders.constData();
            const auto qtCore = wrappedQtHeaders + "/QtCore";
            smartArgs << qtCore;
            clangArguments << "-isystem" << qtCore.constData();
        }
    }

That seems like it might be related. 

FWIW, even on Linux that file didn't get parse correctly initially, with I think the main culprit being the fact that <QList> isn't found:

%> env KDEV_CLANG_DISPLAY_ARGS=1 KDEV_CLANG_DISPLAY_DIAGS=1 kdevelop5 --ps &
Invocation: clang -ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11 -nostdinc -nostdinc++ -xc++ -isystem/usr/include/c++/5 -isystem/usr/include/x86_64-linux-gnu/c++/5 -isystem/usr/include/c++/5/backward -isystem/usr/local/include -isystem/usr/lib/llvm-3.8/lib/clang/3.8.1/include -isystem/usr/include/x86_64-linux-gnu -isystem/include -isystem/usr/include -imacros /tmp/kdevelop.J17152 /home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/languages/clang/duchain/parsesession.cpp
/home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/languages/clang/duchain/parsesession.h:26:10: fatal error: 'QList' file not found
Invocation: clang -ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11 -nostdinc -nostdinc++ -xc++ -include /opt/local/share/kdevclangsupport/gcc_compat.h -isystem /opt/local/share/kdevclangsupport/wrappedQtHeaders -isystem /opt/local/share/kdevclangsupport/wrappedQtHeaders/QtCore -isystem/opt/local/include/qt5 -isystem/usr/lib/llvm-3.5/include -isystem/opt/local/include/qt5 -isystem/opt/local/include/qt5/QtCore -isystem/opt/local/share/qt5/mkspecs/linux-g++-64 -isystem/opt/local/include/KF5/KTextEditor -isystem/opt/local/include/KF5 -isystem/opt/local/include/KF5/KParts -isystem/opt/local/include/KF5/KIOWidgets -isystem/opt/local/include/KF5/KIOCore -isystem/opt/local/include/KF5/KCoreAddons -isystem/opt/local/include/KF5/KService -isystem/opt/local/include/KF5/KConfigCore -isystem/opt/local/include/KF5/KJobWidgets -isystem/opt/local/include/qt5/QtWidgets -isystem/opt/local/include/qt5/QtGui -isystem/opt/local/include/qt5/QtNetwork -isystem/opt/local/include/KF5/KCompletion -isystem/opt/local/include/KF5/KWidgetsAddons -isystem/opt/local/include/KF5/KXmlGui -isystem/opt/local/include/qt5/QtDBus -isystem/opt/local/include/qt5/QtXml -isystem/opt/local/include/KF5/KConfigWidgets -isystem/opt/local/include/KF5/KCodecs -isystem/opt/local/include/KF5/KConfigGui -isystem/opt/local/include/KF5/KAuth -isystem/opt/local/include/KF5/KTextWidgets -isystem/opt/local/include/KF5/SonnetUi -isystem/opt/local/include/KF5/KI18n -isystem/opt/local/include/KF5/ThreadWeaver -isystem/opt/local/include/kdevplatform -isystem/opt/local/include -isystem/opt/local/include/KF5/KItemModels -isystem/usr/lib/llvm-3.5/include -isystem/usr/include/c++/5 -isystem/usr/include/x86_64-linux-gnu/c++/5 -isystem/usr/include/c++/5/backward -isystem/usr/lib/gcc/x86_64-linux-gnu/5/include -isystem/usr/local/include -isystem/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed -isystem/usr/include/x86_64-linux-gnu -isystem/usr/include -I/home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/build/languages/clang -I/home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/languages/clang -I/home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5 -I/home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/build -I/home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/languages/clang/libs -I/home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/languages/plugin -imacros /tmp/kdevelop.K17152 /home/bertin/work/src/Scratch/KDE/KF5/kdevelop-git-5/languages/clang/duchain/parsesession.cpp
/opt/local/include/qt5/QtCore/qcompilerdetection.h:630:38: error: token is not a valid binary operator in a preprocessor subexpression
/usr/lib/gcc/x86_64-linux-gnu/5/include/xmmintrin.h:777:28: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int *' with an rvalue of type '__v2sf *'
(etc)

R.


More information about the KDevelop-devel mailing list