Clang: Optimize file path cache

We now fetch all directories and sources from the database at file
path cache creation.

Change-Id: I92510b49a234128f4c82b840611db82ead3f1a54
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2019-08-06 13:12:03 +02:00
parent 912b4763e0
commit f9fb4508d4
23 changed files with 295 additions and 210 deletions

View File

@@ -194,9 +194,9 @@ TEST_F(StringCache, PopulateWithEmptyVector)
TEST_F(StringCache, IsNotEmptyAfterPopulateWithSomeEntries)
{
CacheEntries entries{{filePath1.clone(), 0},
{filePath2.clone(), 1},
{filePath2.clone(), 3},
{filePath3.clone(), 2},
{filePath4.clone(), 3}};
{filePath4.clone(), 5}};
cache.uncheckedPopulate(std::move(entries));
@@ -207,11 +207,11 @@ TEST_F(StringCache, GetEntryAfterPopulateWithSomeEntries)
{
CacheEntries entries{{filePath1.clone(), 0},
{filePath2.clone(), 1},
{filePath3.clone(), 2},
{filePath3.clone(), 7},
{filePath4.clone(), 3}};
cache.uncheckedPopulate(std::move(entries));
auto string = cache.string(2);
auto string = cache.string(7);
ASSERT_THAT(string, filePath3);
}
@@ -226,16 +226,6 @@ TEST_F(StringCache, EntriesHaveUniqueIds)
ASSERT_THROW(cache.populate(std::move(entries)), StringCacheException);
}
TEST_F(StringCache, IdsAreHigherLowerEntriesSize)
{
CacheEntries entries{{filePath1.clone(), 0},
{filePath2.clone(), 1},
{filePath3.clone(), 4},
{filePath4.clone(), 3}};
ASSERT_THROW(cache.populate(std::move(entries)), std::out_of_range);
}
TEST_F(StringCache, MultipleEntries)
{
CacheEntries entries{{filePath1.clone(), 0},