From c4220041a66d2e3cb6d1237f1cb52acdb14b4c32 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 1 Feb 2018 18:29:45 +0100 Subject: [PATCH] Clang: Rename FileInformation in FileStatus It's more near to the Unix convention and it has a plural too. Change-Id: I53f85911d8fcbaadba9947c70e9a375dc6995ed5 Reviewed-by: Ivan Donchevskii --- .../refactoringdatabaseinitializer.h | 6 ++--- .../source/clangrefactoringbackend-source.pri | 4 ++-- .../collectmacrospreprocessorcallbacks.h | 10 ++++----- .../collectmacrossourcefilecallbacks.cpp | 2 +- .../source/collectmacrossourcefilecallbacks.h | 10 ++++----- .../{fileinformation.h => filestatus.h} | 8 +++---- .../source/storagesqlitestatementfactory.h | 4 ++-- .../source/symbolindexer.cpp | 2 +- .../source/symbolscollector.cpp | 4 ++-- .../source/symbolscollector.h | 2 +- .../source/symbolscollectorinterface.h | 4 ++-- .../source/symbolstorage.h | 12 +++++----- .../source/symbolstorageinterface.h | 4 ++-- .../unit/unittest/gtest-creator-printing.cpp | 10 ++++----- tests/unit/unittest/gtest-creator-printing.h | 4 ++-- tests/unit/unittest/mocksymbolscollector.h | 4 ++-- tests/unit/unittest/mocksymbolstorage.h | 4 ++-- .../refactoringdatabaseinitializer-test.cpp | 8 +++---- .../storagesqlitestatementfactory-test.cpp | 6 ++--- tests/unit/unittest/symbolindexer-test.cpp | 12 +++++----- tests/unit/unittest/symbolscollector-test.cpp | 22 +++++++++---------- tests/unit/unittest/symbolstorage-test.cpp | 10 ++++----- 22 files changed, 76 insertions(+), 76 deletions(-) rename src/tools/clangrefactoringbackend/source/{fileinformation.h => filestatus.h} (89%) diff --git a/src/libs/clangsupport/refactoringdatabaseinitializer.h b/src/libs/clangsupport/refactoringdatabaseinitializer.h index db537785d73..fdddc63d8a2 100644 --- a/src/libs/clangsupport/refactoringdatabaseinitializer.h +++ b/src/libs/clangsupport/refactoringdatabaseinitializer.h @@ -48,7 +48,7 @@ public: createProjectPartsTable(); createProjectPartsSourcesTable(); createUsedMacrosTable(); - createFileInformationsTable(); + createFileStatusesTable(); createSourceDependenciesTable(); transaction.commit(); @@ -148,11 +148,11 @@ public: table.initialize(database); } - void createFileInformationsTable() + void createFileStatusesTable() { Sqlite::Table table; table.setUseIfNotExists(true); - table.setName("fileInformations"); + table.setName("fileStatuses"); table.addColumn("sourceId", Sqlite::ColumnType::Integer, Sqlite::Contraint::PrimaryKey); table.addColumn("size", Sqlite::ColumnType::Integer); table.addColumn("lastModified", Sqlite::ColumnType::Integer); diff --git a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri index f8ae8d34ff4..2490e9256f2 100644 --- a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri +++ b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri @@ -16,8 +16,8 @@ HEADERS += \ $$PWD/projectpartentry.h \ $$PWD/symbolsvisitorbase.h \ $$PWD/usedmacro.h \ - $$PWD/fileinformation.h \ - $$PWD/sourcedependency.h + $$PWD/sourcedependency.h \ + $$PWD/filestatus.h !isEmpty(LIBTOOLING_LIBS) { SOURCES += \ diff --git a/src/tools/clangrefactoringbackend/source/collectmacrospreprocessorcallbacks.h b/src/tools/clangrefactoringbackend/source/collectmacrospreprocessorcallbacks.h index 44b5a870d6f..434675fbb51 100644 --- a/src/tools/clangrefactoringbackend/source/collectmacrospreprocessorcallbacks.h +++ b/src/tools/clangrefactoringbackend/source/collectmacrospreprocessorcallbacks.h @@ -25,7 +25,7 @@ #pragma once -#include "fileinformation.h" +#include "filestatus.h" #include "symbolsvisitorbase.h" #include "sourcedependency.h" #include "sourcelocationsutils.h" @@ -50,7 +50,7 @@ public: SourceLocationEntries &sourceLocationEntries, FilePathIds &sourceFiles, UsedMacros &usedMacros, - FileInformations &fileInformations, + FileStatuses &fileStatuses, SourceDependencies &sourceDependencies, FilePathCachingInterface &filePathCache, const clang::SourceManager &sourceManager, @@ -62,7 +62,7 @@ public: m_sourceLocationEntries(sourceLocationEntries), m_sourceFiles(sourceFiles), m_usedMacros(usedMacros), - m_fileInformations(fileInformations) + m_fileStatuses(fileStatuses) { } @@ -76,7 +76,7 @@ public: const clang::FileEntry *fileEntry = m_sourceManager.getFileEntryForID( m_sourceManager.getFileID(sourceLocation)); if (fileEntry) { - m_fileInformations.emplace_back(filePathId(fileEntry), + m_fileStatuses.emplace_back(filePathId(fileEntry), fileEntry->getSize(), fileEntry->getModificationTime()); addSourceFile(fileEntry); @@ -284,7 +284,7 @@ private: SourceLocationEntries &m_sourceLocationEntries; FilePathIds &m_sourceFiles; UsedMacros &m_usedMacros; - FileInformations &m_fileInformations; + FileStatuses &m_fileStatuses; bool m_skipInclude = false; }; diff --git a/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.cpp b/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.cpp index bfe045ef675..6ca01f2d913 100644 --- a/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.cpp +++ b/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.cpp @@ -38,7 +38,7 @@ bool CollectMacrosSourceFileCallbacks::handleBeginSource(clang::CompilerInstance m_sourceLocationEntries, m_sourceFiles, m_usedMacros, - m_fileInformations, + m_fileStatuses, m_sourceDependencies, m_filePathCache, compilerInstance.getSourceManager(), diff --git a/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.h b/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.h index c977496f1d1..be2ab518568 100644 --- a/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.h +++ b/src/tools/clangrefactoringbackend/source/collectmacrossourcefilecallbacks.h @@ -25,7 +25,7 @@ #pragma once -#include "fileinformation.h" +#include "filestatus.h" #include "sourcedependency.h" #include "sourcelocationentry.h" #include "symbolentry.h" @@ -65,7 +65,7 @@ public: { m_sourceFiles.clear(); m_usedMacros.clear(); - m_fileInformations.clear(); + m_fileStatuses.clear(); } const UsedMacros &usedMacros() const @@ -73,9 +73,9 @@ public: return m_usedMacros; } - const FileInformations &fileInformations() const + const FileStatuses &fileStatuses() const { - return m_fileInformations; + return m_fileStatuses; } const SourceDependencies &sourceDependencies() const @@ -86,7 +86,7 @@ public: private: FilePathIds m_sourceFiles; UsedMacros m_usedMacros; - FileInformations m_fileInformations; + FileStatuses m_fileStatuses; SourceDependencies m_sourceDependencies; SymbolEntries &m_symbolEntries; SourceLocationEntries &m_sourceLocationEntries; diff --git a/src/tools/clangrefactoringbackend/source/fileinformation.h b/src/tools/clangrefactoringbackend/source/filestatus.h similarity index 89% rename from src/tools/clangrefactoringbackend/source/fileinformation.h rename to src/tools/clangrefactoringbackend/source/filestatus.h index 12351ce563c..ddb8152a52a 100644 --- a/src/tools/clangrefactoringbackend/source/fileinformation.h +++ b/src/tools/clangrefactoringbackend/source/filestatus.h @@ -33,10 +33,10 @@ namespace ClangBackEnd { -class FileInformation +class FileStatus { public: - FileInformation(FilePathId filePathId, + FileStatus(FilePathId filePathId, off_t size, std::time_t lastModified) : filePathId(filePathId), @@ -45,7 +45,7 @@ public: {} friend - bool operator==(const FileInformation &first, const FileInformation &second) + bool operator==(const FileStatus &first, const FileStatus &second) { return first.filePathId == second.filePathId && first.size == second.size @@ -58,5 +58,5 @@ public: std::time_t lastModified; }; -using FileInformations = std::vector; +using FileStatuses = std::vector; } diff --git a/src/tools/clangrefactoringbackend/source/storagesqlitestatementfactory.h b/src/tools/clangrefactoringbackend/source/storagesqlitestatementfactory.h index 5976b32df9a..3af27e68f88 100644 --- a/src/tools/clangrefactoringbackend/source/storagesqlitestatementfactory.h +++ b/src/tools/clangrefactoringbackend/source/storagesqlitestatementfactory.h @@ -197,8 +197,8 @@ public: "DELETE FROM newUsedMacros", database }; - WriteStatement insertFileInformations{ - "INSERT OR REPLACE INTO fileInformations(sourceId, size, lastModified) VALUES (?,?,?)", + WriteStatement insertFileStatuses{ + "INSERT OR REPLACE INTO fileStatuses(sourceId, size, lastModified) VALUES (?,?,?)", database }; WriteStatement insertIntoNewSourceDependenciesStatement{ diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp index 50823f86e43..13239155cdf 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp +++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp @@ -71,7 +71,7 @@ void SymbolIndexer::updateProjectPart(V2::ProjectPartContainer &&projectPart, m_symbolStorage.insertOrUpdateUsedMacros(m_symbolsCollector.usedMacros()); - m_symbolStorage.insertFileInformations(m_symbolsCollector.fileInformations()); + m_symbolStorage.insertFileStatuses(m_symbolsCollector.fileStatuses()); m_symbolStorage.insertOrUpdateSourceDependencies(m_symbolsCollector.sourceDependencies()); diff --git a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp index 048da174d2c..0497a1862e0 100644 --- a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp +++ b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp @@ -82,9 +82,9 @@ const UsedMacros &SymbolsCollector::usedMacros() const return m_collectMacrosSourceFileCallbacks.usedMacros(); } -const FileInformations &SymbolsCollector::fileInformations() const +const FileStatuses &SymbolsCollector::fileStatuses() const { - return m_collectMacrosSourceFileCallbacks.fileInformations(); + return m_collectMacrosSourceFileCallbacks.fileStatuses(); } const SourceDependencies &SymbolsCollector::sourceDependencies() const diff --git a/src/tools/clangrefactoringbackend/source/symbolscollector.h b/src/tools/clangrefactoringbackend/source/symbolscollector.h index ef8099d8cc9..f45b03d0e5e 100644 --- a/src/tools/clangrefactoringbackend/source/symbolscollector.h +++ b/src/tools/clangrefactoringbackend/source/symbolscollector.h @@ -52,7 +52,7 @@ public: const SourceLocationEntries &sourceLocations() const override; const FilePathIds &sourceFiles() const override; const UsedMacros &usedMacros() const override; - const FileInformations &fileInformations() const override; + const FileStatuses &fileStatuses() const override; const SourceDependencies &sourceDependencies() const override; private: diff --git a/src/tools/clangrefactoringbackend/source/symbolscollectorinterface.h b/src/tools/clangrefactoringbackend/source/symbolscollectorinterface.h index cad8d4128da..67884b242cc 100644 --- a/src/tools/clangrefactoringbackend/source/symbolscollectorinterface.h +++ b/src/tools/clangrefactoringbackend/source/symbolscollectorinterface.h @@ -25,7 +25,7 @@ #pragma once -#include "fileinformation.h" +#include "filestatus.h" #include "symbolentry.h" #include "sourcedependency.h" #include "sourcelocationentry.h" @@ -56,7 +56,7 @@ public: virtual const SourceLocationEntries &sourceLocations() const = 0; virtual const FilePathIds &sourceFiles() const = 0; virtual const UsedMacros &usedMacros() const = 0; - virtual const FileInformations &fileInformations() const = 0; + virtual const FileStatuses &fileStatuses() const = 0; virtual const SourceDependencies &sourceDependencies() const = 0; }; diff --git a/src/tools/clangrefactoringbackend/source/symbolstorage.h b/src/tools/clangrefactoringbackend/source/symbolstorage.h index 7e4775bfd5c..b71eda880d0 100644 --- a/src/tools/clangrefactoringbackend/source/symbolstorage.h +++ b/src/tools/clangrefactoringbackend/source/symbolstorage.h @@ -120,14 +120,14 @@ public: insertStatement.write(projectPartId, sourceFilePathId.filePathId); } - void insertFileInformations(const FileInformations &fileInformations) + void insertFileStatuses(const FileStatuses &fileStatuses) { - WriteStatement &statement = m_statementFactory.insertFileInformations; + WriteStatement &statement = m_statementFactory.insertFileStatuses; - for (const FileInformation &fileInformation : fileInformations) - statement.write(fileInformation.filePathId.filePathId, - fileInformation.size, - fileInformation.lastModified); + for (const FileStatus &fileStatus : fileStatuses) + statement.write(fileStatus.filePathId.filePathId, + fileStatus.size, + fileStatus.lastModified); } static Utils::SmallString toJson(const Utils::SmallStringVector &strings) diff --git a/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h b/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h index dc7c657aaec..2c774f97f77 100644 --- a/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h +++ b/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h @@ -25,7 +25,7 @@ #pragma once -#include "fileinformation.h" +#include "filestatus.h" #include "projectpartentry.h" #include "sourcelocationentry.h" #include "sourcedependency.h" @@ -52,7 +52,7 @@ public: virtual void updateProjectPartSources(Utils::SmallStringView projectPartName, const FilePathIds &sourceFilePathIds) = 0; virtual void insertOrUpdateUsedMacros(const UsedMacros &usedMacros) = 0; - virtual void insertFileInformations(const FileInformations &fileInformations) = 0; + virtual void insertFileStatuses(const FileStatuses &fileStatuses) = 0; virtual void insertOrUpdateSourceDependencies(const SourceDependencies &sourceDependencies) = 0; }; diff --git a/tests/unit/unittest/gtest-creator-printing.cpp b/tests/unit/unittest/gtest-creator-printing.cpp index 8e18764f891..5cb3330afc6 100644 --- a/tests/unit/unittest/gtest-creator-printing.cpp +++ b/tests/unit/unittest/gtest-creator-printing.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -855,14 +855,14 @@ std::ostream &operator<<(std::ostream &out, const UsedMacro &usedMacro) << ")"; } -std::ostream &operator<<(std::ostream &out, const FileInformation &fileInformation) +std::ostream &operator<<(std::ostream &out, const FileStatus &fileStatus) { return out << "(" - << fileInformation.filePathId + << fileStatus.filePathId << ", " - << fileInformation.size + << fileStatus.size << ", " - << fileInformation.lastModified + << fileStatus.lastModified << ")"; } diff --git a/tests/unit/unittest/gtest-creator-printing.h b/tests/unit/unittest/gtest-creator-printing.h index f2e00b9f9e5..8515d960f36 100644 --- a/tests/unit/unittest/gtest-creator-printing.h +++ b/tests/unit/unittest/gtest-creator-printing.h @@ -133,7 +133,7 @@ using NativeFilePathView = AbstractFilePathView<'\\'>; class ToolTipInfo; class ProjectPartEntry; class UsedMacro; -class FileInformation; +class FileStatus; class SourceDependency; std::ostream &operator<<(std::ostream &out, const SourceLocationEntry &entry); @@ -198,7 +198,7 @@ std::ostream &operator<<(std::ostream &out, const FilePathView &filePathView); std::ostream &operator<<(std::ostream &out, const NativeFilePathView &nativeFilePathView); std::ostream &operator<<(std::ostream &out, const ProjectPartEntry &projectPartEntry); std::ostream &operator<<(std::ostream &out, const UsedMacro &usedMacro); -std::ostream &operator<<(std::ostream &out, const FileInformation &fileInformation); +std::ostream &operator<<(std::ostream &out, const FileStatus &fileStatus); std::ostream &operator<<(std::ostream &out, const SourceDependency &sourceDependency); void PrintTo(const FilePath &filePath, ::std::ostream *os); diff --git a/tests/unit/unittest/mocksymbolscollector.h b/tests/unit/unittest/mocksymbolscollector.h index f0bf4a6555f..9d8edb4bc30 100644 --- a/tests/unit/unittest/mocksymbolscollector.h +++ b/tests/unit/unittest/mocksymbolscollector.h @@ -57,8 +57,8 @@ public: MOCK_CONST_METHOD0(usedMacros, const ClangBackEnd::UsedMacros &()); - MOCK_CONST_METHOD0(fileInformations, - const ClangBackEnd::FileInformations &()); + MOCK_CONST_METHOD0(fileStatuses, + const ClangBackEnd::FileStatuses &()); MOCK_CONST_METHOD0(sourceDependencies, const ClangBackEnd::SourceDependencies &()); diff --git a/tests/unit/unittest/mocksymbolstorage.h b/tests/unit/unittest/mocksymbolstorage.h index f2bfd954a0a..57edc93454e 100644 --- a/tests/unit/unittest/mocksymbolstorage.h +++ b/tests/unit/unittest/mocksymbolstorage.h @@ -46,8 +46,8 @@ public: const ClangBackEnd::FilePathIds &sourceFilePathIds)); MOCK_METHOD1(insertOrUpdateUsedMacros, void (const ClangBackEnd::UsedMacros &usedMacros)); - MOCK_METHOD1(insertFileInformations, - void (const ClangBackEnd::FileInformations &fileInformations)); + MOCK_METHOD1(insertFileStatuses, + void (const ClangBackEnd::FileStatuses &fileStatuses)); MOCK_METHOD1(insertOrUpdateSourceDependencies, void (const ClangBackEnd::SourceDependencies &sourceDependencies)); }; diff --git a/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp b/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp index 1080fa46e23..60c171e8307 100644 --- a/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp +++ b/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp @@ -114,13 +114,13 @@ TEST_F(RefactoringDatabaseInitializer, AddUsedMacrosTable) initializer.createUsedMacrosTable(); } -TEST_F(RefactoringDatabaseInitializer, AddFileInformationsTable) +TEST_F(RefactoringDatabaseInitializer, AddFileStatusesTable) { InSequence s; - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileInformations(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileStatuses(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER)"))); - initializer.createFileInformationsTable(); + initializer.createFileStatusesTable(); } TEST_F(RefactoringDatabaseInitializer, AddSourceDependenciesTable) @@ -154,7 +154,7 @@ TEST_F(RefactoringDatabaseInitializer, CreateInTheContructor) EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS usedMacros(usedMacroId INTEGER PRIMARY KEY, sourceId INTEGER, macroName TEXT)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_usedMacros_sourceId_macroName ON usedMacros(sourceId, macroName)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_usedMacros_macroName ON usedMacros(macroName)"))); - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileInformations(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileStatuses(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS sourceDependencies(sourceId INTEGER, dependencySourceId INTEGER)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_sourceDependencies_sourceId_dependencySourceId ON sourceDependencies(sourceId, dependencySourceId)"))); EXPECT_CALL(mockDatabase, commit()); diff --git a/tests/unit/unittest/storagesqlitestatementfactory-test.cpp b/tests/unit/unittest/storagesqlitestatementfactory-test.cpp index b9a80f5b5fa..c7e1c45992c 100644 --- a/tests/unit/unittest/storagesqlitestatementfactory-test.cpp +++ b/tests/unit/unittest/storagesqlitestatementfactory-test.cpp @@ -226,10 +226,10 @@ TEST_F(StorageSqliteStatementFactory, DeleteAllInNewUnusedMacros) Eq("DELETE FROM newUsedMacros")); } -TEST_F(StorageSqliteStatementFactory, InsertFileInformations) +TEST_F(StorageSqliteStatementFactory, InsertFileStatuses) { - ASSERT_THAT(factory.insertFileInformations.sqlStatement, - Eq("INSERT OR REPLACE INTO fileInformations(sourceId, size, lastModified) VALUES (?,?,?)")); + ASSERT_THAT(factory.insertFileStatuses.sqlStatement, + Eq("INSERT OR REPLACE INTO fileStatuses(sourceId, size, lastModified) VALUES (?,?,?)")); } TEST_F(StorageSqliteStatementFactory, InsertIntoNewSourceDependencies) diff --git a/tests/unit/unittest/symbolindexer-test.cpp b/tests/unit/unittest/symbolindexer-test.cpp index 4fea3116153..076c5993c1f 100644 --- a/tests/unit/unittest/symbolindexer-test.cpp +++ b/tests/unit/unittest/symbolindexer-test.cpp @@ -37,7 +37,7 @@ namespace { using Utils::PathString; -using ClangBackEnd::FileInformations; +using ClangBackEnd::FileStatuses; using ClangBackEnd::FilePathIds; using ClangBackEnd::FilePathView; using ClangBackEnd::V2::ProjectPartContainer; @@ -67,7 +67,7 @@ protected: ON_CALL(mockCollector, sourceLocations()).WillByDefault(ReturnRef(sourceLocations)); ON_CALL(mockCollector, sourceFiles()).WillByDefault(ReturnRef(sourceFileIds)); ON_CALL(mockCollector, usedMacros()).WillByDefault(ReturnRef(usedMacros)); - ON_CALL(mockCollector, fileInformations()).WillByDefault(ReturnRef(fileInformation)); + ON_CALL(mockCollector, fileStatuses()).WillByDefault(ReturnRef(fileStatus)); ON_CALL(mockCollector, sourceDependencies()).WillByDefault(ReturnRef(sourceDependencies)); } @@ -95,7 +95,7 @@ protected: SourceLocationEntries sourceLocations{{1, {1, 1}, {42, 23}, SymbolType::Declaration}}; FilePathIds sourceFileIds{{1, 1}, {42, 23}}; UsedMacros usedMacros{{"Foo", {1, 1}}}; - FileInformations fileInformation{{{1, 2}, 3, 4}}; + FileStatuses fileStatus{{{1, 2}, 3, 4}}; SourceDependencies sourceDependencies{{{1, 1}, {1, 2}}, {{1, 1}, {1, 3}}}; NiceMock mockSqliteTransactionBackend; NiceMock mockCollector; @@ -199,9 +199,9 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertOrUpdateUsedMacros) indexer.updateProjectParts({projectPart1, projectPart2}, Utils::clone(unsaved)); } -TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertFileInformations) +TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertFileStatuses) { - EXPECT_CALL(mockStorage, insertFileInformations(Eq(fileInformation))) + EXPECT_CALL(mockStorage, insertFileStatuses(Eq(fileStatus))) .Times(2); indexer.updateProjectParts({projectPart1, projectPart2}, Utils::clone(unsaved)); @@ -228,7 +228,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrder) EXPECT_CALL(mockStorage, insertOrUpdateProjectPart(_, _, _)); EXPECT_CALL(mockStorage, updateProjectPartSources(_, _)); EXPECT_CALL(mockStorage, insertOrUpdateUsedMacros(Eq(usedMacros))); - EXPECT_CALL(mockStorage, insertFileInformations(Eq(fileInformation))); + EXPECT_CALL(mockStorage, insertFileStatuses(Eq(fileStatus))); EXPECT_CALL(mockStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); EXPECT_CALL(mockSqliteTransactionBackend, commit()); diff --git a/tests/unit/unittest/symbolscollector-test.cpp b/tests/unit/unittest/symbolscollector-test.cpp index ac243f272ca..62cafbc37d9 100644 --- a/tests/unit/unittest/symbolscollector-test.cpp +++ b/tests/unit/unittest/symbolscollector-test.cpp @@ -28,7 +28,7 @@ #include "filesystem-utilities.h" #include -#include +#include #include #include @@ -115,7 +115,7 @@ protected: return QFileInfo(QString(filePath)).lastModified().toTime_t(); } - ClangBackEnd::FileInformation fileInformation(Utils::SmallStringView filePath) const + ClangBackEnd::FileStatus fileStatus(Utils::SmallStringView filePath) const { return {filePathId(filePath), fileSize(filePath), lastModified(filePath)}; } @@ -304,14 +304,14 @@ TEST_F(SymbolsCollector, ClearSourceLocations) ASSERT_THAT(collector.sourceLocations(), IsEmpty()); } -TEST_F(SymbolsCollector, ClearFileInformation) +TEST_F(SymbolsCollector, ClearFileStatus) { collector.addFiles({filePathId(TESTDATA_DIR "/symbolscollector_main.cpp")}, {"cc"}); collector.collectSymbols(); collector.clear(); - ASSERT_THAT(collector.fileInformations(), IsEmpty()); + ASSERT_THAT(collector.fileStatuses(), IsEmpty()); } TEST_F(SymbolsCollector, ClearUsedMacros) @@ -344,14 +344,14 @@ TEST_F(SymbolsCollector, DontCollectSourceFilesAfterFilesAreCleared) ASSERT_THAT(collector.sourceFiles(), IsEmpty()); } -TEST_F(SymbolsCollector, DontCollectFileInformationAfterFilesAreCleared) +TEST_F(SymbolsCollector, DontCollectFileStatusAfterFilesAreCleared) { collector.addFiles({filePathId(TESTDATA_DIR "/symbolscollector_main.cpp")}, {"cc"}); collector.clear(); collector.collectSymbols(); - ASSERT_THAT(collector.fileInformations(), IsEmpty()); + ASSERT_THAT(collector.fileStatuses(), IsEmpty()); } TEST_F(SymbolsCollector, DontCollectUsedMacrosAfterFilesAreCleared) @@ -552,18 +552,18 @@ TEST_F(SymbolsCollector, CollectMacroCompilerArgumentSymbols) Contains(HasSymbolName("COMPILER_ARGUMENT"))); } -TEST_F(SymbolsCollector, CollectFileInformations) +TEST_F(SymbolsCollector, CollectFileStatuses) { auto fileId = filePathId(TESTDATA_DIR "/symbolscollector_main.cpp"); collector.addFiles({fileId}, {"cc"}); collector.collectSymbols(); - ASSERT_THAT(collector.fileInformations(), + ASSERT_THAT(collector.fileStatuses(), ElementsAre( - fileInformation(TESTDATA_DIR "/symbolscollector_main.cpp"), - fileInformation(TESTDATA_DIR "/symbolscollector_header1.h"), - fileInformation(TESTDATA_DIR "/symbolscollector_header2.h"))); + fileStatus(TESTDATA_DIR "/symbolscollector_main.cpp"), + fileStatus(TESTDATA_DIR "/symbolscollector_header1.h"), + fileStatus(TESTDATA_DIR "/symbolscollector_header2.h"))); } TEST_F(SymbolsCollector, CollectSourceDependencies) diff --git a/tests/unit/unittest/symbolstorage-test.cpp b/tests/unit/unittest/symbolstorage-test.cpp index be52f57389c..5a64a79579c 100644 --- a/tests/unit/unittest/symbolstorage-test.cpp +++ b/tests/unit/unittest/symbolstorage-test.cpp @@ -78,7 +78,7 @@ protected: MockSqliteWriteStatement &syncNewUsedMacrosStatement = statementFactory.syncNewUsedMacrosStatement; MockSqliteWriteStatement &deleteOutdatedUsedMacrosStatement = statementFactory.deleteOutdatedUsedMacrosStatement; MockSqliteWriteStatement &deleteNewUsedMacrosTableStatement = statementFactory.deleteNewUsedMacrosTableStatement; - MockSqliteWriteStatement &insertFileInformations = statementFactory.insertFileInformations; + MockSqliteWriteStatement &insertFileStatuses = statementFactory.insertFileStatuses; MockSqliteWriteStatement &insertIntoNewSourceDependenciesStatement = statementFactory.insertIntoNewSourceDependenciesStatement; MockSqliteWriteStatement &syncNewSourceDependenciesStatement = statementFactory.syncNewSourceDependenciesStatement; MockSqliteWriteStatement &deleteOutdatedSourceDependenciesStatement = statementFactory.deleteOutdatedSourceDependenciesStatement; @@ -235,12 +235,12 @@ TEST_F(SymbolStorage, InsertOrUpdateUsedMacros) storage.insertOrUpdateUsedMacros({{"FOO", {1, 42}}, {"BAR", {1, 43}}}); } -TEST_F(SymbolStorage, InsertFileInformations) +TEST_F(SymbolStorage, InsertFileStatuses) { - EXPECT_CALL(insertFileInformations, write(TypedEq(42), TypedEq(1), TypedEq(2))); - EXPECT_CALL(insertFileInformations, write(TypedEq(43), TypedEq(4), TypedEq(5))); + EXPECT_CALL(insertFileStatuses, write(TypedEq(42), TypedEq(1), TypedEq(2))); + EXPECT_CALL(insertFileStatuses, write(TypedEq(43), TypedEq(4), TypedEq(5))); - storage.insertFileInformations({{{1, 42}, 1, 2}, {{1, 43}, 4, 5}}); + storage.insertFileStatuses({{{1, 42}, 1, 2}, {{1, 43}, 4, 5}}); } TEST_F(SymbolStorage, InsertOrUpdateSourceDependencies)