Clang: Add source dependency saving to the symbol storage

The source dependencies are simply a table which connects the include file
with the included file.

Change-Id: I5454e81a2b5b98f05c7ff3f6740a6d45e01772c3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-01-30 18:41:45 +01:00
parent 490523fdbb
commit 89b9dfed84
10 changed files with 164 additions and 3 deletions

View File

@@ -79,6 +79,10 @@ protected:
MockSqliteWriteStatement &deleteOutdatedUsedMacrosStatement = statementFactory.deleteOutdatedUsedMacrosStatement;
MockSqliteWriteStatement &deleteNewUsedMacrosTableStatement = statementFactory.deleteNewUsedMacrosTableStatement;
MockSqliteWriteStatement &insertFileInformations = statementFactory.insertFileInformations;
MockSqliteWriteStatement &insertIntoNewSourceDependenciesStatement = statementFactory.insertIntoNewSourceDependenciesStatement;
MockSqliteWriteStatement &syncNewSourceDependenciesStatement = statementFactory.syncNewSourceDependenciesStatement;
MockSqliteWriteStatement &deleteOutdatedSourceDependenciesStatement = statementFactory.deleteOutdatedSourceDependenciesStatement;
MockSqliteWriteStatement &deleteNewSourceDependenciesStatement = statementFactory.deleteNewSourceDependenciesStatement;
SymbolEntries symbolEntries{{1, {"functionUSR", "function"}},
{2, {"function2USR", "function2"}}};
SourceLocationEntries sourceLocations{{1, {1, 3}, {42, 23}, SymbolType::Declaration},
@@ -239,5 +243,18 @@ TEST_F(SymbolStorage, InsertFileInformations)
storage.insertFileInformations({{{1, 42}, 1, 2}, {{1, 43}, 4, 5}});
}
TEST_F(SymbolStorage, InsertOrUpdateSourceDependencies)
{
InSequence sequence;
EXPECT_CALL(insertIntoNewSourceDependenciesStatement, write(TypedEq<int>(42), TypedEq<int>(1)));
EXPECT_CALL(insertIntoNewSourceDependenciesStatement, write(TypedEq<int>(42), TypedEq<int>(2)));
EXPECT_CALL(syncNewSourceDependenciesStatement, execute());
EXPECT_CALL(deleteOutdatedSourceDependenciesStatement, execute());
EXPECT_CALL(deleteNewSourceDependenciesStatement, execute());
storage.insertOrUpdateSourceDependencies({{{1, 42}, {1, 1}}, {{1, 42}, {1, 2}}});
}
}