diff options
Diffstat (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp')
-rw-r--r-- | src/plugins/cpptools/compileroptionsbuilder.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index a5bf1ad0b6..c529e96b45 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -28,6 +28,7 @@ #include <projectexplorer/projectexplorerconstants.h> #include <QDir> +#include <QRegularExpression> namespace CppTools { @@ -393,7 +394,15 @@ bool CompilerOptionsBuilder::excludeDefineLine(const QByteArray &defineLine) con bool CompilerOptionsBuilder::excludeHeaderPath(const QString &headerPath) const { - Q_UNUSED(headerPath); + // A clang tool chain might have another version and passing in the + // intrinsics path from that version will lead to errors (unknown + // intrinsics, unfavorable order with regard to include_next). + if (m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) { + static QRegularExpression clangIncludeDir( + QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z")); + return clangIncludeDir.match(headerPath).hasMatch(); + } + return false; } |