Clang: Support MSVC style of compiler flags

Clang has MSVC compatible mode which works with MSVC style command line
flags.

When possible use the same flags (-I, -D, -U, etc.) and in other cases
either replace by MSVC analog (for example use /FI instead of -include)
or pass the argument with '/clang:' prefix (requires
https://reviews.llvm.org/D53457).

Change-Id: I95f33bed5dc8d9493895ed8d4359cdd70fc774b8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-01-11 15:32:12 +01:00
parent 4c0c3f5a64
commit 0348009e0e
8 changed files with 467 additions and 209 deletions

View File

@@ -86,10 +86,10 @@ public:
void addExtraOptions() final
{
addDummyUiHeaderOnDiskIncludePath();
add("-fmessage-length=0");
add("-fdiagnostics-show-note-include-stack");
add("-fmessage-length=0", /*gccOnlyOption=*/true);
add("-fdiagnostics-show-note-include-stack", /*gccOnlyOption=*/true);
add("-fretain-comments-from-system-headers", /*gccOnlyOption=*/true);
add("-fmacro-backtrace-limit=0");
add("-fretain-comments-from-system-headers");
add("-ferror-limit=1000");
}
@@ -97,10 +97,8 @@ private:
void addDummyUiHeaderOnDiskIncludePath()
{
const QString path = ClangModelManagerSupport::instance()->dummyUiHeaderOnDiskDirPath();
if (!path.isEmpty()) {
add("-I");
add(QDir::toNativeSeparators(path));
}
if (!path.isEmpty())
add({"-I", QDir::toNativeSeparators(path)});
}
};