Clang: Fix system pre include search path

We now get the resource path from creator. The -fPIC case is working now
too.

Change-Id: Id191e89e6d46706748d50440038a06a349972cc9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2019-04-24 14:07:39 +02:00
parent 1975641a3d
commit 2d520140d0
42 changed files with 398 additions and 234 deletions

View File

@@ -29,6 +29,7 @@
#include "symbolindexertaskqueue.h"
#include <commandlinebuilder.h>
#include <environment.h>
#include <chrono>
#include <iostream>
@@ -67,7 +68,8 @@ SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQ
FileStatusCache &fileStatusCache,
Sqlite::TransactionInterface &transactionInterface,
ProjectPartsStorageInterface &projectPartsStorage,
ModifiedTimeCheckerInterface<SourceTimeStamps> &modifiedTimeChecker)
ModifiedTimeCheckerInterface<SourceTimeStamps> &modifiedTimeChecker,
const Environment &environment)
: m_symbolIndexerTaskQueue(symbolIndexerTaskQueue)
, m_symbolStorage(symbolStorage)
, m_buildDependencyStorage(buildDependenciesStorage)
@@ -78,6 +80,7 @@ SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQ
, m_transactionInterface(transactionInterface)
, m_projectPartsStorage(projectPartsStorage)
, m_modifiedTimeChecker(modifiedTimeChecker)
, m_environment(environment)
{
pathWatcher.setNotifier(this);
}
@@ -99,8 +102,10 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
sourcePathId);
if (!m_modifiedTimeChecker.isUpToDate(dependentTimeStamps)) {
auto indexing = [projectPart = std::move(projectPart), sourcePathId, this](
SymbolsCollectorInterface &symbolsCollector) {
auto indexing = [projectPart = std::move(projectPart),
sourcePathId,
preIncludeSearchPath = m_environment.preIncludeSearchPath(),
this](SymbolsCollectorInterface &symbolsCollector) {
auto collect = [&](const FilePath &pchPath) {
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
Builder commandLineBuilder{projectPart,
@@ -108,7 +113,8 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
InputFileType::Source,
{},
{},
pchPath};
pchPath,
preIncludeSearchPath};
symbolsCollector.setFile(sourcePathId, commandLineBuilder.commandLine);
return symbolsCollector.collectSymbols();
@@ -174,13 +180,21 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
SourceTimeStamps dependentTimeStamps = m_symbolStorage.fetchIncludedIndexingTimeStamps(filePathId);
auto indexing = [optionalArtefact = std::move(optionalArtefact), filePathId, this](
SymbolsCollectorInterface &symbolsCollector) {
auto indexing = [optionalArtefact = std::move(optionalArtefact),
filePathId,
preIncludeSearchPath = m_environment.preIncludeSearchPath(),
this](SymbolsCollectorInterface &symbolsCollector) {
auto collect = [&](const FilePath &pchPath) {
const ProjectPartArtefact &artefact = *optionalArtefact;
using Builder = CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector>;
Builder builder{artefact, artefact.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
Builder builder{artefact,
artefact.toolChainArguments,
InputFileType::Source,
{},
{},
pchPath,
preIncludeSearchPath};
symbolsCollector.setFile(filePathId, builder.commandLine);

View File

@@ -40,6 +40,7 @@
namespace ClangBackEnd {
class SymbolsCollectorInterface;
class Environment;
class SymbolIndexer final : public ClangPathWatcherNotifier
{
@@ -53,7 +54,8 @@ public:
FileStatusCache &fileStatusCache,
Sqlite::TransactionInterface &transactionInterface,
ProjectPartsStorageInterface &projectPartsStorage,
ModifiedTimeCheckerInterface<SourceTimeStamps> &modifiedTimeChecker);
ModifiedTimeCheckerInterface<SourceTimeStamps> &modifiedTimeChecker,
const Environment &environment);
void updateProjectParts(ProjectPartContainers &&projectParts);
void updateProjectPart(ProjectPartContainer &&projectPart);
@@ -84,6 +86,7 @@ private:
Sqlite::TransactionInterface &m_transactionInterface;
ProjectPartsStorageInterface &m_projectPartsStorage;
ModifiedTimeCheckerInterface<SourceTimeStamps> &m_modifiedTimeChecker;
const Environment &m_environment;
};
} // namespace ClangBackEnd

View File

@@ -85,7 +85,8 @@ public:
SymbolIndexing(Sqlite::Database &database,
FilePathCachingInterface &filePathCache,
const GeneratedFiles &generatedFiles,
ProgressCounter::SetProgressCallback &&setProgressCallback)
ProgressCounter::SetProgressCallback &&setProgressCallback,
const Environment &environment)
: m_filePathCache(filePathCache)
, m_buildDependencyStorage(database)
, m_precompiledHeaderStorage(database)
@@ -93,6 +94,17 @@ public:
, m_symbolStorage(database)
, m_collectorManger(generatedFiles, database)
, m_progressCounter(std::move(setProgressCallback))
, m_indexer(m_indexerQueue,
m_symbolStorage,
m_buildDependencyStorage,
m_precompiledHeaderStorage,
m_sourceWatcher,
m_filePathCache,
m_fileStatusCache,
m_symbolStorage.database,
m_projectPartsStorage,
m_modifiedTimeChecker,
environment)
, m_indexerScheduler(m_collectorManger,
m_indexerQueue,
m_progressCounter,
@@ -139,16 +151,7 @@ private:
}};
ModifiedTimeChecker<ClangBackEnd::SourceTimeStamps> m_modifiedTimeChecker{getModifiedTime,
m_filePathCache};
SymbolIndexer m_indexer{m_indexerQueue,
m_symbolStorage,
m_buildDependencyStorage,
m_precompiledHeaderStorage,
m_sourceWatcher,
m_filePathCache,
m_fileStatusCache,
m_symbolStorage.database,
m_projectPartsStorage,
m_modifiedTimeChecker};
SymbolIndexer m_indexer;
SymbolIndexerTaskQueue m_indexerQueue{m_indexerScheduler, m_progressCounter};
SymbolIndexerTaskScheduler m_indexerScheduler;
};