aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-26 07:41:26 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-26 08:44:53 +0000
commit499596609679fb490b29ddedf4be0664534583a3 (patch)
tree1b98fb37d587514b5da7c158c09b7c81a49358e9
parent0f247c44a76f26587a5ea0ac9414e054da1f35e1 (diff)
shiboken6: Build with MSVC 19.28.29334
Use clang builtin-includes. Pick-to: 5.15 Fixes: PYSIDE-1433 Change-Id: I91c87f8ff764d126acf4bb6aa564c515e61ab0a4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp
index 659324f8c..4f3a927dc 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp
@@ -232,7 +232,9 @@ static QByteArray noStandardIncludeOption() { return QByteArrayLiteral("-nostdin
// should be picked up automatically by clang without specifying
// them implicitly.
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
+// Besides g++/Linux, as of MSVC 19.28.29334, MSVC needs clang includes
+// due to PYSIDE-1433, LLVM-47099
+#if !defined(Q_OS_DARWIN)
# define NEED_CLANG_BUILTIN_INCLUDES 1
#else
# define NEED_CLANG_BUILTIN_INCLUDES 0
@@ -301,6 +303,24 @@ static QString compilerFromCMake(const QString &defaultCompiler)
}
#endif // Q_CC_CLANG, Q_CC_GNU
+#if NEED_CLANG_BUILTIN_INCLUDES
+static void appendClangBuiltinIncludes(HeaderPaths *p)
+{
+ const QString clangBuiltinIncludesDir =
+ QDir::toNativeSeparators(findClangBuiltInIncludesDir());
+ if (clangBuiltinIncludesDir.isEmpty()) {
+ qCWarning(lcShiboken, "Unable to locate Clang's built-in include directory "
+ "(neither by checking the environment variables LLVM_INSTALL_DIR, CLANG_INSTALL_DIR "
+ " nor running llvm-config). This may lead to parse errors.");
+ } else {
+ qCInfo(lcShiboken, "CLANG builtins includes directory: %s",
+ qPrintable(clangBuiltinIncludesDir));
+ p->append(HeaderPath{QFile::encodeName(clangBuiltinIncludesDir),
+ HeaderType::System});
+ }
+}
+#endif // NEED_CLANG_BUILTIN_INCLUDES
+
// Returns clang options needed for emulating the host compiler
QByteArrayList emulatedCompilerOptions()
{
@@ -312,26 +332,19 @@ QByteArrayList emulatedCompilerOptions()
result.append(QByteArrayLiteral("-Wno-microsoft-enum-value"));
// Fix yvals_core.h: STL1000: Unexpected compiler version, expected Clang 7 or newer (MSVC2017 update)
result.append(QByteArrayLiteral("-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"));
+# if NEED_CLANG_BUILTIN_INCLUDES
+ appendClangBuiltinIncludes(&headerPaths);
+# endif // NEED_CLANG_BUILTIN_INCLUDES
+
#elif defined(Q_CC_CLANG)
HeaderPaths headerPaths = gppInternalIncludePaths(compilerFromCMake(QStringLiteral("clang++")));
result.append(noStandardIncludeOption());
#elif defined(Q_CC_GNU)
HeaderPaths headerPaths;
-#if NEED_CLANG_BUILTIN_INCLUDES
- const QString clangBuiltinIncludesDir =
- QDir::toNativeSeparators(findClangBuiltInIncludesDir());
- if (clangBuiltinIncludesDir.isEmpty()) {
- qCWarning(lcShiboken, "Unable to locate Clang's built-in include directory "
- "(neither by checking the environment variables LLVM_INSTALL_DIR, CLANG_INSTALL_DIR "
- " nor running llvm-config). This may lead to parse errors.");
- } else {
- qCInfo(lcShiboken, "CLANG builtins includes directory: %s",
- qPrintable(clangBuiltinIncludesDir));
- headerPaths.append(HeaderPath{QFile::encodeName(clangBuiltinIncludesDir),
- HeaderType::System});
- }
-#endif // NEED_CLANG_BUILTIN_INCLUDES
+# if NEED_CLANG_BUILTIN_INCLUDES
+ appendClangBuiltinIncludes(&headerPaths);
+# endif // NEED_CLANG_BUILTIN_INCLUDES
// Append the c++ include paths since Clang is unable to find <list> etc
// on RHEL 7 with g++ 6.3 or CentOS 7.2.