CompilationDbManager: Add support for the "/imsvc" option

Fixes: QTCREATORBUG-23146
Change-Id: I024597d67e48595472b398ed40858bee17c1c4b9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Christian Kandeler
2019-10-28 15:28:07 +01:00
parent 86bd49e6ab
commit 74d458c0da

View File

@@ -28,6 +28,7 @@
#include <projectexplorer/headerpath.h> #include <projectexplorer/headerpath.h>
#include <projectexplorer/projectmacro.h> #include <projectexplorer/projectmacro.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/optional.h> #include <utils/optional.h>
@@ -155,14 +156,16 @@ void filteredFlags(const QString &fileName,
continue; continue;
} }
if ((flag.startsWith("-I") || flag.startsWith("-isystem") || flag.startsWith("/I")) const QStringList userIncludeFlags{"-I", "/I"};
&& flag != "-I" && flag != "-isystem" && flag != "/I") { const QStringList systemIncludeFlags{"-isystem", "-imsvc", "/imsvc"};
bool userInclude = flag.startsWith("-I"); const QStringList allIncludeFlags = QStringList(userIncludeFlags) << systemIncludeFlags;
const QString pathStr = updatedPathFlag(flag.mid(userInclude ? 2 : 8), const QString includeOpt = Utils::findOrDefault(allIncludeFlags, [flag](const QString &opt) {
workingDir); return flag.startsWith(opt) && flag != opt;
headerPaths.append({pathStr, userInclude });
? HeaderPathType::User if (!includeOpt.isEmpty()) {
: HeaderPathType::System}); const QString pathStr = updatedPathFlag(flag.mid(includeOpt.length()), workingDir);
headerPaths.append({pathStr, userIncludeFlags.contains(includeOpt)
? HeaderPathType::User : HeaderPathType::System});
continue; continue;
} }
@@ -174,8 +177,12 @@ void filteredFlags(const QString &fileName,
continue; continue;
} }
if (flag == "-I" || flag == "-isystem" || flag == "/I") { if (userIncludeFlags.contains(flag)) {
includePathType = (flag != "-isystem") ? HeaderPathType::User : HeaderPathType::System; includePathType = HeaderPathType::User;
continue;
}
if (systemIncludeFlags.contains(flag)) {
includePathType = HeaderPathType::System;
continue; continue;
} }