Clang: Add macro names the to project part

So we can compare later if the macro names have changed.

Change-Id: I65c5f76e07fced8df6cc7282c03430adffcf5fa8
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-01-29 12:07:15 +01:00
parent 8b85b095b2
commit c0b771f99c
11 changed files with 44 additions and 22 deletions

View File

@@ -143,11 +143,11 @@ public:
database
};
WriteStatement insertProjectPartStatement{
"INSERT OR IGNORE INTO projectParts(projectPartName, compilerArguments) VALUES (?,?)",
"INSERT OR IGNORE INTO projectParts(projectPartName, compilerArguments, macroNames) VALUES (?,?,?)",
database
};
WriteStatement updateProjectPartStatement{
"UPDATE projectParts SET compilerArguments = ? WHERE projectPartName = ?",
"UPDATE projectParts SET compilerArguments = ?, macroNames = ? WHERE projectPartName = ?",
database
};
ReadStatement getProjectPartIdStatement{

View File

@@ -64,7 +64,8 @@ void SymbolIndexer::updateProjectPart(V2::ProjectPartContainer &&projectPart,
m_symbolsCollector.sourceLocations());
m_symbolStorage.insertOrUpdateProjectPart(projectPart.projectPartId(),
projectPart.arguments());
projectPart.arguments(),
projectPart.macroNames());
m_symbolStorage.updateProjectPartSources(projectPart.projectPartId(),
m_symbolsCollector.sourceFiles());

View File

@@ -66,18 +66,20 @@ public:
}
void insertOrUpdateProjectPart(Utils::SmallStringView projectPartName,
const Utils::SmallStringVector &commandLineArguments) override
const Utils::SmallStringVector &commandLineArguments,
const Utils::SmallStringVector &macroNames) override
{
m_statementFactory.database.setLastInsertedRowId(-1);
Utils::SmallString compilerArguementsAsJson = toJson(commandLineArguments);
Utils::SmallString macroNamesAsJson = toJson(macroNames);
WriteStatement &insertStatement = m_statementFactory.insertProjectPartStatement;
insertStatement.write(projectPartName, compilerArguementsAsJson);
insertStatement.write(projectPartName, compilerArguementsAsJson, macroNamesAsJson);
if (m_statementFactory.database.lastInsertedRowId() == -1) {
WriteStatement &updateStatement = m_statementFactory.updateProjectPartStatement;
updateStatement.write(compilerArguementsAsJson, projectPartName);
updateStatement.write(compilerArguementsAsJson, macroNamesAsJson, projectPartName);
}
}

View File

@@ -45,7 +45,8 @@ public:
virtual void addSymbolsAndSourceLocations(const SymbolEntries &symbolEntries,
const SourceLocationEntries &sourceLocations) = 0;
virtual void insertOrUpdateProjectPart(Utils::SmallStringView projectPartName,
const Utils::SmallStringVector &commandLineArguments) = 0;
const Utils::SmallStringVector &commandLineArguments,
const Utils::SmallStringVector &macroNames) = 0;
virtual void updateProjectPartSources(Utils::SmallStringView projectPartName,
const FilePathIds &sourceFilePathIds) = 0;
virtual void insertOrUpdateUsedMacros(const UsedMacros &usedMacros) = 0;