Merge remote-tracking branch 'origin/4.10'

Change-Id: Iaf27911e4e9fb762c1a24c84c458462bafe95728
This commit is contained in:
Tim Jenssen
2019-07-12 15:53:56 +02:00
126 changed files with 9456 additions and 6532 deletions

View File

@@ -19,9 +19,6 @@ add_qtc_library(clangrefactoringbackend_lib STATIC
collectmacrossourcefilecallbacks.cpp collectmacrossourcefilecallbacks.h
collectsymbolsaction.cpp collectsymbolsaction.h
filestatuspreprocessorcallbacks.cpp filestatuspreprocessorcallbacks.h
findcursorusr.h
findlocationsofusrs.h
findusrforcursoraction.cpp findusrforcursoraction.h
indexdataconsumer.cpp indexdataconsumer.h
locationsourcefilecallbacks.cpp locationsourcefilecallbacks.h
macropreprocessorcallbacks.cpp macropreprocessorcallbacks.h
@@ -35,14 +32,12 @@ add_qtc_library(clangrefactoringbackend_lib STATIC
sourcerangefilter.cpp sourcerangefilter.h
sourcesmanager.h
symbolentry.h
symbolfinder.cpp symbolfinder.h
symbolindexer.cpp symbolindexer.h
symbolindexertask.h
symbolindexertaskqueue.h
symbolindexertaskqueueinterface.h
symbolindexing.cpp symbolindexing.h
symbolindexinginterface.h
symbollocationfinderaction.cpp symbollocationfinderaction.h
symbolscollector.cpp symbolscollector.h
symbolscollectorinterface.h
symbolstorage.h

View File

@@ -44,7 +44,6 @@ HEADERS += \
$$PWD/refactoringserver.h \
$$PWD/macropreprocessorcallbacks.h \
$$PWD/sourcelocationsutils.h \
$$PWD/findcursorusr.h \
$$PWD/clangquery.h \
$$PWD/clangtool.h \
$$PWD/sourcerangeextractor.h \

View File

@@ -57,7 +57,7 @@ void ClangTool::addUnsavedFiles(const V2::FileContainers &unsavedFiles)
m_unsavedFileContents.reserve(m_unsavedFileContents.size() + unsavedFiles.size());
auto convertToUnsavedFileContent = [](const V2::FileContainer &unsavedFile) {
return UnsavedFileContent{unsavedFile.filePath.clone(),
return UnsavedFileContent{NativeFilePath{unsavedFile.filePath},
unsavedFile.unsavedFileContent.clone()};
};

View File

@@ -55,12 +55,12 @@ struct FileContent
struct UnsavedFileContent
{
UnsavedFileContent(FilePath &&filePath, Utils::SmallString &&content)
UnsavedFileContent(NativeFilePath &&filePath, Utils::SmallString &&content)
: filePath(std::move(filePath))
, content(std::move(content))
{}
FilePath filePath;
NativeFilePath filePath;
Utils::SmallString content;
};

View File

@@ -142,7 +142,8 @@ void RefactoringServer::setGathererProcessingSlotCount(uint count)
void RefactoringServer::setProgress(int progress, int total)
{
client()->progress({ProgressType::Indexing, progress, total});
if (client())
client()->progress({ProgressType::Indexing, progress, total});
}
void RefactoringServer::gatherSourceRangesForQueryMessages(

View File

@@ -91,12 +91,31 @@ void SymbolIndexer::updateProjectParts(ProjectPartContainers &&projectParts)
updateProjectPart(std::move(projectPart));
}
namespace {
void store(SymbolStorageInterface &symbolStorage,
BuildDependenciesStorageInterface &buildDependencyStorage,
Sqlite::TransactionInterface &transactionInterface,
SymbolsCollectorInterface &symbolsCollector)
{
try {
Sqlite::ImmediateTransaction transaction{transactionInterface};
buildDependencyStorage.insertOrUpdateIndexingTimeStamps(symbolsCollector.fileStatuses());
symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
symbolsCollector.sourceLocations());
transaction.commit();
} catch (const Sqlite::StatementIsBusy &) {
store(symbolStorage, buildDependencyStorage, transactionInterface, symbolsCollector);
}
}
} // namespace
void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
{
ProjectPartId projectPartId = projectPart.projectPartId;
std::vector<SymbolIndexerTask> symbolIndexerTask;
symbolIndexerTask.reserve(projectPart.sourcePathIds.size());
for (FilePathId sourcePathId : projectPart.sourcePathIds) {
SourceTimeStamps dependentTimeStamps = m_buildDependencyStorage.fetchIncludedIndexingTimeStamps(
sourcePathId);
@@ -117,27 +136,28 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
preIncludeSearchPath};
symbolsCollector.setFile(sourcePathId, commandLineBuilder.commandLine);
return symbolsCollector.collectSymbols();
};
auto store = [&] {
Sqlite::ImmediateTransaction transaction{m_transactionInterface};
m_buildDependencyStorage.insertOrUpdateIndexingTimeStamps(
symbolsCollector.fileStatuses());
m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
symbolsCollector.sourceLocations());
transaction.commit();
return symbolsCollector.collectSymbols();
};
const PchPaths pchPaths = m_precompiledHeaderStorage.fetchPrecompiledHeaders(
projectPart.projectPartId);
if (pchPaths.projectPchPath.size() && collect(pchPaths.projectPchPath)) {
store();
store(m_symbolStorage,
m_buildDependencyStorage,
m_transactionInterface,
symbolsCollector);
} else if (pchPaths.systemPchPath.size() && collect(pchPaths.systemPchPath)) {
store();
store(m_symbolStorage,
m_buildDependencyStorage,
m_transactionInterface,
symbolsCollector);
} else if (collect({})) {
store();
store(m_symbolStorage,
m_buildDependencyStorage,
m_transactionInterface,
symbolsCollector);
}
};
@@ -196,23 +216,15 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
return symbolsCollector.collectSymbols();
};
auto store = [&] {
Sqlite::ImmediateTransaction transaction{m_transactionInterface};
m_buildDependencyStorage.insertOrUpdateIndexingTimeStamps(symbolsCollector.fileStatuses());
m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
symbolsCollector.sourceLocations());
transaction.commit();
};
const PchPaths pchPaths = m_precompiledHeaderStorage.fetchPrecompiledHeaders(
optionalArtefact->projectPartId);
if (pchPaths.projectPchPath.size() && collect(pchPaths.projectPchPath)) {
store();
store(m_symbolStorage, m_buildDependencyStorage, m_transactionInterface, symbolsCollector);
} else if (pchPaths.systemPchPath.size() && collect(pchPaths.systemPchPath)) {
store();
store(m_symbolStorage, m_buildDependencyStorage, m_transactionInterface, symbolsCollector);
} else if (collect({})) {
store();
store(m_symbolStorage, m_buildDependencyStorage, m_transactionInterface, symbolsCollector);
}
};

View File

@@ -54,6 +54,7 @@ public:
, database(database)
{
transaction.commit();
database.walCheckpointFull();
}
void addSymbolsAndSourceLocations(const SymbolEntries &symbolEntries,