forked from qt-creator/qt-creator
CppTools: Make code model on "cl" mode more robust
Unknown command line options starting with / are now transformed into commands starting with -, which will cause unknown commands warnings in libclang. The / commands cause errors because they are treated as missing files. Fixes: QTCREATORBUG-22871 Change-Id: I75f7878ab6a7951df24c954ccff1c298ea65f839 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -792,6 +792,15 @@ void CompilerOptionsBuilder::evaluateCompilerFlags()
|
||||
containsDriverMode = true;
|
||||
}
|
||||
|
||||
// Transfrom the "/" starting commands into "-" commands, which if
|
||||
// unknown will not cause clang to fail because it thinks
|
||||
// it's a missing file.
|
||||
if (theOption.startsWith("/") &&
|
||||
(toolChain == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID ||
|
||||
toolChain == ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID)) {
|
||||
theOption[0] = '-';
|
||||
}
|
||||
|
||||
m_compilerFlags.flags.append(theOption);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user