Clang: Fix language version detection with PCH-s in CMake enabled

Filter out the PCH flags when detecting macros and language version.

Fixes: QTCREATORBUG-21860
Change-Id: I25c63f1409c16db3623d1c8f43ffd5d2bd0f6748
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-03-04 11:07:53 +01:00
parent ce888b45ef
commit d9703158ee
2 changed files with 11 additions and 0 deletions

View File

@@ -741,6 +741,15 @@ void CompilerOptionsBuilder::evaluateCompilerFlags()
continue;
}
if (option.startsWith("/Y", Qt::CaseSensitive)
|| (option.startsWith("/F", Qt::CaseSensitive) && option != "/F")) {
// Precompiled header flags.
// Skip also the next option if it's not glued to the current one.
if (option.size() > 3)
skipNext = true;
continue;
}
// Check whether a language version is already used.
QString theOption = option;
if (theOption.startsWith("-std=")) {