forked from qt-creator/qt-creator
Clang: Provide include directory only for libclang
Only libclang has issues with the include directory search therefore undefining include folders makes sense only for libclang options builder. Change-Id: Ie3f62f5f3a89503e6e0ab59e18889e92425c3abc Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -39,14 +39,8 @@
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
static constexpr char SYSTEM_INCLUDE_PREFIX[] = "-isystem";
|
||||
|
||||
CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart,
|
||||
const QString &clangVersion,
|
||||
const QString &clangResourceDirectory)
|
||||
CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart)
|
||||
: m_projectPart(projectPart)
|
||||
, m_clangVersion(clangVersion)
|
||||
, m_clangResourceDirectory(clangResourceDirectory)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -500,31 +494,9 @@ bool CompilerOptionsBuilder::excludeHeaderPath(const QString &headerPath) const
|
||||
|
||||
void CompilerOptionsBuilder::addPredefinedHeaderPathsOptions()
|
||||
{
|
||||
add("-nostdinc");
|
||||
add("-nostdlibinc");
|
||||
|
||||
// In case of MSVC we need builtin clang defines to correctly handle clang includes
|
||||
if (m_projectPart.toolchainType != ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID)
|
||||
add("-undef");
|
||||
|
||||
addClangIncludeFolder();
|
||||
}
|
||||
|
||||
static QString clangIncludeDirectory(const QString &clangVersion,
|
||||
const QString &clangResourceDirectory)
|
||||
{
|
||||
#ifndef UNIT_TESTS
|
||||
return Core::ICore::clangIncludeDirectory(clangVersion, clangResourceDirectory);
|
||||
#else
|
||||
return QString();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addClangIncludeFolder()
|
||||
{
|
||||
QTC_CHECK(!m_clangVersion.isEmpty());
|
||||
add(SYSTEM_INCLUDE_PREFIX);
|
||||
add(clangIncludeDirectory(m_clangVersion, m_clangResourceDirectory));
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addProjectConfigFileInclude()
|
||||
|
||||
@@ -39,9 +39,7 @@ public:
|
||||
Use
|
||||
};
|
||||
|
||||
CompilerOptionsBuilder(const ProjectPart &projectPart,
|
||||
const QString &clangVersion = QString(),
|
||||
const QString &clangResourceDirectory = QString());
|
||||
CompilerOptionsBuilder(const ProjectPart &projectPart);
|
||||
virtual ~CompilerOptionsBuilder() {}
|
||||
|
||||
virtual void addTargetTriple();
|
||||
@@ -90,11 +88,8 @@ private:
|
||||
QByteArray macroOption(const ProjectExplorer::Macro ¯o) const;
|
||||
QByteArray toDefineOption(const ProjectExplorer::Macro ¯o) const;
|
||||
QString defineDirectiveToDefineOption(const ProjectExplorer::Macro &marco) const;
|
||||
void addClangIncludeFolder();
|
||||
|
||||
QStringList m_options;
|
||||
QString m_clangVersion;
|
||||
QString m_clangResourceDirectory;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
Reference in New Issue
Block a user