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 14:59:38 +0100
commit5abf8ea6d34bb1d36f884d525a962449bbb10ba3 (patch)
treebf7892f6c5898f4157bd7f19c9016527d04f2355
parent57a5bc7a850dc0ce7f2d13f58823dee966af3c46 (diff)
shiboken6: Build with MSVC 19.28.29334
Use clang builtin-includes. Fixes: PYSIDE-1433 Change-Id: I91c87f8ff764d126acf4bb6aa564c515e61ab0a4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 499596609679fb490b29ddedf4be0664534583a3) Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index dac511003..0b58cf5a5 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/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()
{
@@ -311,26 +331,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.