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:
Ivan Donchevskii
2018-08-07 15:21:20 +02:00
parent 44b931f7f5
commit 62e776aa8e
9 changed files with 38 additions and 52 deletions

View File

@@ -186,16 +186,12 @@ private:
bool m_success = false;
};
static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos,
const QString &clangVersion,
const QString &clangResourceDirectory)
static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos)
{
AnalyzeUnits unitsToAnalyze;
const CompilerOptionsBuilder::PchUsage pchUsage = CppTools::getPchUsage();
for (const FileInfo &fileInfo : fileInfos) {
CompilerOptionsBuilder optionsBuilder(*fileInfo.projectPart,
clangVersion,
clangResourceDirectory);
CompilerOptionsBuilder optionsBuilder(*fileInfo.projectPart);
QStringList arguments = extraClangToolsPrependOptions();
arguments.append(optionsBuilder.build(fileInfo.kind, pchUsage));
arguments.append(extraClangToolsAppendOptions());
@@ -205,13 +201,11 @@ static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos,
return unitsToAnalyze;
}
AnalyzeUnits ClangToolRunControl::unitsToAnalyze(const QString &clangVersion)
AnalyzeUnits ClangToolRunControl::unitsToAnalyze()
{
QTC_ASSERT(m_projectInfo.isValid(), return AnalyzeUnits());
const QString clangResourceDirectory = Core::ICore::clangIncludeDirectory(m_clangExecutable,
clangVersion);
return toAnalyzeUnits(m_fileInfos, clangVersion, clangResourceDirectory);
return toAnalyzeUnits(m_fileInfos);
}
static QDebug operator<<(QDebug debug, const Utils::Environment &environment)
@@ -313,7 +307,7 @@ void ClangToolRunControl::start()
}
// Collect files
const AnalyzeUnits unitsToProcess = unitsToAnalyze(CLANG_VERSION);
const AnalyzeUnits unitsToProcess = unitsToAnalyze();
qCDebug(LOG) << "Files to process:" << unitsToProcess;
m_unitsToProcess = unitsToProcess;
m_initialFilesToProcessSize = m_unitsToProcess.count();