forked from qt-creator/qt-creator
Clang: macOS: fix unknown integer types
Always exclude clang include paths which do not come with libclang used by code model. This solves the issue with GCC that uses system clang include folder on macOS. Task-number: QTCREATORBUG-19397 Change-Id: I3b4845248a3cf03a95fbd4038856f8fb31346bfa Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -89,16 +89,6 @@ ClangCompilerOptionsBuilder::ClangCompilerOptionsBuilder(const CppTools::Project
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClangCompilerOptionsBuilder::excludeHeaderPath(const QString &path) const
|
|
||||||
{
|
|
||||||
if (m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID
|
|
||||||
&& path.contains("lib/gcc/i686-apple-darwin")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CompilerOptionsBuilder::excludeHeaderPath(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCompilerOptionsBuilder::addPredefinedHeaderPathsOptions()
|
void ClangCompilerOptionsBuilder::addPredefinedHeaderPathsOptions()
|
||||||
{
|
{
|
||||||
add("-undef");
|
add("-undef");
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ public:
|
|||||||
virtual void addPredefinedHeaderPathsOptions();
|
virtual void addPredefinedHeaderPathsOptions();
|
||||||
virtual void addExtraOptions();
|
virtual void addExtraOptions();
|
||||||
|
|
||||||
bool excludeHeaderPath(const QString &path) const override;
|
|
||||||
|
|
||||||
virtual void addWrappedQtHeadersIncludePath();
|
virtual void addWrappedQtHeadersIncludePath();
|
||||||
void addProjectConfigFileInclude();
|
void addProjectConfigFileInclude();
|
||||||
|
|
||||||
|
|||||||
@@ -440,16 +440,13 @@ bool CompilerOptionsBuilder::excludeDefineDirective(const ProjectExplorer::Macro
|
|||||||
|
|
||||||
bool CompilerOptionsBuilder::excludeHeaderPath(const QString &headerPath) const
|
bool CompilerOptionsBuilder::excludeHeaderPath(const QString &headerPath) const
|
||||||
{
|
{
|
||||||
// A clang tool chain might have another version and passing in the
|
// Always exclude clang system includes (including intrinsics) which do not come with libclang
|
||||||
// intrinsics path from that version will lead to errors (unknown
|
// that Qt Creator uses for code model.
|
||||||
// intrinsics, unfavorable order with regard to include_next).
|
// For example GCC on macOS uses system clang include path which makes clang code model
|
||||||
if (m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) {
|
// include incorrect system headers.
|
||||||
static QRegularExpression clangIncludeDir(
|
static QRegularExpression clangIncludeDir(
|
||||||
QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z"));
|
QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z"));
|
||||||
return clangIncludeDir.match(headerPath).hasMatch();
|
return clangIncludeDir.match(headerPath).hasMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CppTools
|
} // namespace CppTools
|
||||||
|
|||||||
Reference in New Issue
Block a user