forked from qt-creator/qt-creator
Clang: Use PathString in more cases
Change-Id: I7bee469256a79b384bf7b8c1d5355f1df11c7b24 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const QString connection = processArguments(application);
|
||||
|
||||
StringCache<Utils::SmallString> filePathCache;
|
||||
StringCache<Utils::PathString> filePathCache;
|
||||
ClangPathWatcher<QFileSystemWatcher, QTimer> includeWatcher(filePathCache);
|
||||
ApplicationEnvironment environment;
|
||||
PchGenerator<QProcess> pchGenerator(environment);
|
||||
|
@@ -55,12 +55,12 @@ public:
|
||||
restartTimer();
|
||||
}
|
||||
|
||||
Utils::SmallStringVector takeFilePaths()
|
||||
Utils::PathStringVector takeFilePaths()
|
||||
{
|
||||
return std::move(m_filePaths);
|
||||
}
|
||||
|
||||
virtual void setCallback(std::function<void(Utils::SmallStringVector &&)> &&callback)
|
||||
virtual void setCallback(std::function<void(Utils::PathStringVector &&)> &&callback)
|
||||
{
|
||||
QObject::connect(&m_timer,
|
||||
&Timer::timeout,
|
||||
@@ -79,7 +79,7 @@ unitttest_public:
|
||||
}
|
||||
|
||||
private:
|
||||
Utils::SmallStringVector m_filePaths;
|
||||
Utils::PathStringVector m_filePaths;
|
||||
Timer m_timer;
|
||||
};
|
||||
|
||||
|
@@ -68,7 +68,7 @@ template <typename FileSystemWatcher,
|
||||
class ClangPathWatcher : public ClangPathWatcherInterface
|
||||
{
|
||||
public:
|
||||
ClangPathWatcher(StringCache<Utils::SmallString> &pathCache,
|
||||
ClangPathWatcher(StringCache<Utils::PathString> &pathCache,
|
||||
ClangPathWatcherNotifier *notifier=nullptr)
|
||||
: m_pathCache(pathCache),
|
||||
m_notifier(notifier)
|
||||
@@ -77,14 +77,14 @@ public:
|
||||
&FileSystemWatcher::fileChanged,
|
||||
[&] (const QString &filePath) { compressChangedFilePath(filePath); });
|
||||
|
||||
m_changedFilePathCompressor.setCallback([&] (Utils::SmallStringVector &&filePaths) {
|
||||
m_changedFilePathCompressor.setCallback([&] (Utils::PathStringVector &&filePaths) {
|
||||
addChangedPathForFilePath(std::move(filePaths));
|
||||
});
|
||||
}
|
||||
|
||||
~ClangPathWatcher()
|
||||
{
|
||||
m_changedFilePathCompressor.setCallback([&] (Utils::SmallStringVector &&) {});
|
||||
m_changedFilePathCompressor.setCallback([&] (Utils::PathStringVector &&) {});
|
||||
}
|
||||
|
||||
void updateIdPaths(const std::vector<IdPaths> &idPaths) override
|
||||
@@ -366,7 +366,7 @@ unitttest_public:
|
||||
m_changedFilePathCompressor.addFilePath(filePath);
|
||||
}
|
||||
|
||||
WatcherEntries watchedEntriesForPaths(Utils::SmallStringVector &&filePaths)
|
||||
WatcherEntries watchedEntriesForPaths(Utils::PathStringVector &&filePaths)
|
||||
{
|
||||
std::vector<uint> pathIds = m_pathCache.stringIds(filePaths);
|
||||
|
||||
@@ -403,7 +403,7 @@ unitttest_public:
|
||||
return std::move(ids);
|
||||
}
|
||||
|
||||
void addChangedPathForFilePath(Utils::SmallStringVector &&filePaths)
|
||||
void addChangedPathForFilePath(Utils::PathStringVector &&filePaths)
|
||||
{
|
||||
if (m_notifier) {
|
||||
WatcherEntries foundEntries = watchedEntriesForPaths(std::move(filePaths));
|
||||
@@ -414,7 +414,7 @@ unitttest_public:
|
||||
}
|
||||
}
|
||||
|
||||
StringCache<Utils::SmallString> &pathCache()
|
||||
StringCache<Utils::PathString> &pathCache()
|
||||
{
|
||||
return m_pathCache;
|
||||
}
|
||||
@@ -429,7 +429,7 @@ private:
|
||||
WatcherEntries m_watchedEntries;
|
||||
ChangedFilePathCompressor<Timer> m_changedFilePathCompressor;
|
||||
FileSystemWatcher m_fileSystemWatcher;
|
||||
StringCache<Utils::SmallString> &m_pathCache;
|
||||
StringCache<Utils::PathString> &m_pathCache;
|
||||
ClangPathWatcherNotifier *m_notifier;
|
||||
};
|
||||
|
||||
|
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
PchManagerServer::PchManagerServer(StringCache<Utils::SmallString> &filePathCache,
|
||||
PchManagerServer::PchManagerServer(StringCache<Utils::PathString> &filePathCache,
|
||||
ClangPathWatcherInterface &fileSystemWatcher,
|
||||
PchCreatorInterface &pchCreator,
|
||||
ProjectPartsInterface &projectParts)
|
||||
|
@@ -42,7 +42,7 @@ class PchManagerServer : public PchManagerServerInterface,
|
||||
public PchGeneratorNotifierInterface
|
||||
{
|
||||
public:
|
||||
PchManagerServer(StringCache<Utils::SmallString> &filePathCache,
|
||||
PchManagerServer(StringCache<Utils::PathString> &filePathCache,
|
||||
ClangPathWatcherInterface &fileSystemWatcher,
|
||||
PchCreatorInterface &pchCreator,
|
||||
ProjectPartsInterface &projectParts);
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
void taskFinished(TaskFinishStatus status, const ProjectPartPch &projectPartPch) override;
|
||||
|
||||
private:
|
||||
StringCache<Utils::SmallString> &m_filePathCache;
|
||||
StringCache<Utils::PathString> &m_filePathCache;
|
||||
ClangPathWatcherInterface &m_fileSystemWatcher;
|
||||
PchCreatorInterface &m_pchCreator;
|
||||
ProjectPartsInterface &m_projectParts;
|
||||
|
@@ -79,7 +79,7 @@ TEST_F(ChangedFilePathCompressor, CallTimeOutAfterAddingPath)
|
||||
|
||||
void ChangedFilePathCompressor::SetUp()
|
||||
{
|
||||
compressor.setCallback([&] (Utils::SmallStringVector &&filePaths) {
|
||||
compressor.setCallback([&] (Utils::PathStringVector &&filePaths) {
|
||||
mockCompressor.callbackCalled(filePaths);
|
||||
});
|
||||
}
|
||||
|
@@ -46,15 +46,15 @@ using ClangBackEnd::WatcherEntry;
|
||||
class ClangPathWatcher : public testing::Test
|
||||
{
|
||||
protected:
|
||||
ClangBackEnd::StringCache<Utils::SmallString> pathCache;
|
||||
ClangBackEnd::StringCache<Utils::PathString> pathCache;
|
||||
NiceMock<MockClangPathWatcherNotifier> notifier;
|
||||
Watcher watcher{pathCache, ¬ifier};
|
||||
NiceMock<MockQFileSytemWatcher> &mockQFileSytemWatcher = watcher.fileSystemWatcher();
|
||||
Utils::SmallString id1{"id4"};
|
||||
Utils::SmallString id2{"id2"};
|
||||
Utils::SmallString id3{"id3"};
|
||||
Utils::SmallString path1{"/path/path1"};
|
||||
Utils::SmallString path2{"/path/path2"};
|
||||
Utils::PathString path1{"/path/path1"};
|
||||
Utils::PathString path2{"/path/path2"};
|
||||
std::vector<uint> paths = watcher.pathCache().stringIds({path1, path2});
|
||||
std::vector<uint> ids = watcher.idCache().stringIds({id1, id2, id3});
|
||||
WatcherEntry watcherEntry1{ids[0], paths[0]};
|
||||
|
@@ -38,6 +38,6 @@ public:
|
||||
void ());
|
||||
|
||||
MOCK_METHOD1(callbackCalled,
|
||||
void (const Utils::SmallStringVector &filePaths));
|
||||
void (const Utils::PathStringVector &filePaths));
|
||||
};
|
||||
|
||||
|
@@ -59,7 +59,7 @@ protected:
|
||||
NiceMock<MockPchCreator> mockPchCreator;
|
||||
NiceMock<MockClangPathWatcher> mockClangPathWatcher;
|
||||
NiceMock<MockProjectParts> mockProjectParts;
|
||||
ClangBackEnd::StringCache<Utils::SmallString> filePathCache;
|
||||
ClangBackEnd::StringCache<Utils::PathString> filePathCache;
|
||||
ClangBackEnd::PchManagerServer server{filePathCache, mockClangPathWatcher, mockPchCreator, mockProjectParts};
|
||||
NiceMock<MockPchManagerClient> mockPchManagerClient;
|
||||
SmallString projectPartId1 = "project1";
|
||||
|
Reference in New Issue
Block a user