Clang: Improve LLVM_CXXFLAGS

Remove MSVC-specific flags and split the string into
separate flags.

Change-Id: Idce7c2e988651df670c0119245dc6f6c89461c41
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-08-15 10:44:49 +02:00
parent ec5e70eeda
commit 0bc721fa04

View File

@@ -80,6 +80,37 @@ defineReplace(findClangLibInLibDir) {
} }
} }
defineReplace(splitFlags) {
flags = $$1
inside_quotes = 0
starting_substr = $$str_member($$flags, 0, 0)
equals(starting_substr, "\"") {
inside_quotes = 1
}
flags_temp = $$split(flags, "\"")
for (flag, flags_temp) {
equals(inside_quotes, 0) {
inside_quotes = 1
flag ~= s,-I\S*,
flag ~= s,/D\S*,
flag ~= s,/Z\S*,
result += $$split(flag, " ")
} else {
inside_quotes = 0
starting_substr = $$str_member($$flag, 0, 0)
!equals(starting_substr, "/") {
starting_substr = $$str_member($$flag, 0, 1)
!equals(starting_substr, "-I") {
result += "\"$$flag\""
}
}
}
}
return($$result)
}
CLANGTOOLING_LIBS=-lclangTooling -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \ CLANGTOOLING_LIBS=-lclangTooling -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \
-lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \ -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \
-lclangASTMatchers -lclangToolingCore -lclangAST -lclangLex -lclangBasic -lclangASTMatchers -lclangToolingCore -lclangAST -lclangLex -lclangBasic
@@ -180,6 +211,8 @@ isEmpty(LLVM_VERSION) {
LLVM_CXXFLAGS ~= s,/O\S*, LLVM_CXXFLAGS ~= s,/O\S*,
LLVM_CXXFLAGS ~= s,/W4, LLVM_CXXFLAGS ~= s,/W4,
LLVM_CXXFLAGS ~= s,/EH\S*, LLVM_CXXFLAGS ~= s,/EH\S*,
LLVM_CXXFLAGS ~= s,/M\S*,
LLVM_CXXFLAGS ~= s,/G\S*,
LLVM_CXXFLAGS ~= s,-Werror=date-time, LLVM_CXXFLAGS ~= s,-Werror=date-time,
LLVM_CXXFLAGS ~= s,-Wcovered-switch-default, LLVM_CXXFLAGS ~= s,-Wcovered-switch-default,
LLVM_CXXFLAGS ~= s,-fPIC, LLVM_CXXFLAGS ~= s,-fPIC,
@@ -188,6 +221,8 @@ isEmpty(LLVM_VERSION) {
# split-dwarf needs objcopy which does not work via icecc out-of-the-box # split-dwarf needs objcopy which does not work via icecc out-of-the-box
LLVM_CXXFLAGS ~= s,-gsplit-dwarf, LLVM_CXXFLAGS ~= s,-gsplit-dwarf,
LLVM_CXXFLAGS = $$splitFlags($$LLVM_CXXFLAGS)
LLVM_IS_COMPILED_WITH_RTTI = $$system($$llvm_config --has-rtti, lines) LLVM_IS_COMPILED_WITH_RTTI = $$system($$llvm_config --has-rtti, lines)
unix:!disable_external_rpath:!contains(QMAKE_DEFAULT_LIBDIRS, $${LLVM_LIBDIR}) { unix:!disable_external_rpath:!contains(QMAKE_DEFAULT_LIBDIRS, $${LLVM_LIBDIR}) {