forked from qt-creator/qt-creator
CompilationDatabaseProjectManager: Fix flags extraction
The code would blindly remove all "options" starting with /, which meant that all file paths arguments got lost on Unix-like hosts. Fixes: QTCREATORBUG-22949 Change-Id: I43e2b1e57ed0e9ced9da8fa46d98d9ac25f83d13 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
@@ -239,13 +240,15 @@ void CompilationDatabaseTests::testFilterCommand()
|
|||||||
"SemaCodeComplete");
|
"SemaCodeComplete");
|
||||||
testData.getFilteredFlags();
|
testData.getFilteredFlags();
|
||||||
|
|
||||||
QCOMPARE(testData.flags,
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
(QStringList{"/Zc:inline", "/Zc:strictStrings", "/Zc:rvalueCast", "/Zi"}));
|
QCOMPARE(testData.flags,
|
||||||
QCOMPARE(testData.headerPaths,
|
(QStringList{"/Zc:inline", "/Zc:strictStrings", "/Zc:rvalueCast", "/Zi"}));
|
||||||
toUserHeaderPaths(QStringList{"C:/build-qt_llvm-msvc2017_64bit-Debug/tools\\clang\\lib\\Sema"}));
|
QCOMPARE(testData.headerPaths,
|
||||||
QCOMPARE(testData.macros, (Macros{{"UNICODE", "1"}, {"_HAS_EXCEPTIONS", "0"}, {"WIN32", "1"},
|
toUserHeaderPaths(QStringList{"C:/build-qt_llvm-msvc2017_64bit-Debug/tools\\clang\\lib\\Sema"}));
|
||||||
{"_WINDOWS", "1"}}));
|
QCOMPARE(testData.macros, (Macros{{"UNICODE", "1"}, {"_HAS_EXCEPTIONS", "0"}, {"WIN32", "1"},
|
||||||
QCOMPARE(testData.fileKind, CppEditor::ProjectFile::Kind::CXXSource);
|
{"_WINDOWS", "1"}}));
|
||||||
|
QCOMPARE(testData.fileKind, CppEditor::ProjectFile::Kind::CXXSource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilationDatabaseTests::testFileKindDifferentFromExtension()
|
void CompilationDatabaseTests::testFileKindDifferentFromExtension()
|
||||||
|
@@ -206,7 +206,7 @@ void filteredFlags(const QString &fileName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip all remaining Windows flags except feature flags.
|
// Skip all remaining Windows flags except feature flags.
|
||||||
if (flag.startsWith("/") && !flag.startsWith("/Z"))
|
if (Utils::HostOsInfo::isWindowsHost() && flag.startsWith("/") && !flag.startsWith("/Z"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
filtered.push_back(flag);
|
filtered.push_back(flag);
|
||||||
|
Reference in New Issue
Block a user