forked from qt-creator/qt-creator
ClangStaticAnalyzer: Fix path for intrinsics for clang toolchains
Ignore the include path for intrinsics coming from the toolchain. The clang static analyzer comes with its own intrinsics and does not cope well with intrinsics from other clang versions. Move the relevant implementation from LibClangOptionsBuilder into the base class so that ClangStaticAnalyzer profits from this, too. Task-number: QTCREATORBUG-17102 Change-Id: Id9a28ddebb889c862939332dce888a80b3bb7e63 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QStringList>
|
||||
|
||||
using namespace ClangCodeModel;
|
||||
@@ -118,18 +117,12 @@ private:
|
||||
|
||||
bool excludeHeaderPath(const QString &path) const override
|
||||
{
|
||||
if (path.contains(QLatin1String("lib/gcc/i686-apple-darwin")))
|
||||
return true;
|
||||
if (m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) {
|
||||
if (path.contains(QLatin1String("lib/gcc/i686-apple-darwin")))
|
||||
return true;
|
||||
}
|
||||
|
||||
// We already provide a custom clang include path matching the used libclang version,
|
||||
// so better ignore the clang include paths from the system as this might lead to an
|
||||
// unfavorable order with regard to include_next.
|
||||
static QRegularExpression clangIncludeDir(
|
||||
QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z"));
|
||||
if (clangIncludeDir.match(path).hasMatch())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return CompilerOptionsBuilder::excludeHeaderPath(path);
|
||||
}
|
||||
|
||||
void addPredefinedMacrosAndHeaderPathsOptions()
|
||||
|
||||
Reference in New Issue
Block a user