diff options
| author | Haojian Wu <hokein@google.com> | 2018-11-14 11:55:45 +0000 |
|---|---|---|
| committer | Haojian Wu <hokein@google.com> | 2018-11-14 11:55:45 +0000 |
| commit | ee54a2b501cf1d3e7e722d63c00463103a3b9cc4 (patch) | |
| tree | 6162ece147b8835cc1f0f2e9e748555836477c2e /clang-tools-extra/unittests/clangd/SerializationTests.cpp | |
| parent | ee78ae6b869eccfb9938b18ab204453d2c0de638 (diff) | |
| download | bcm5719-llvm-ee54a2b501cf1d3e7e722d63c00463103a3b9cc4.tar.gz bcm5719-llvm-ee54a2b501cf1d3e7e722d63c00463103a3b9cc4.zip | |
[clangd] Replace StringRef in SymbolLocation with a char pointer.
Summary:
This would save us 8 bytes per ref, and buy us ~40MB in total
for llvm index (from ~300MB to ~260 MB).
The char pointer must be null-terminated, and llvm::StringSaver
guarantees it.
Reviewers: sammccall
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53427
llvm-svn: 346852
Diffstat (limited to 'clang-tools-extra/unittests/clangd/SerializationTests.cpp')
| -rw-r--r-- | clang-tools-extra/unittests/clangd/SerializationTests.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang-tools-extra/unittests/clangd/SerializationTests.cpp b/clang-tools-extra/unittests/clangd/SerializationTests.cpp index af3290f0399..8b40cd66b80 100644 --- a/clang-tools-extra/unittests/clangd/SerializationTests.cpp +++ b/clang-tools-extra/unittests/clangd/SerializationTests.cpp @@ -111,7 +111,7 @@ TEST(SerializationTest, YAMLConversions) { EXPECT_EQ(Sym1.Signature, ""); EXPECT_EQ(Sym1.Documentation, "Foo doc"); EXPECT_EQ(Sym1.ReturnType, "int"); - EXPECT_EQ(Sym1.CanonicalDeclaration.FileURI, "file:///path/foo.h"); + EXPECT_EQ(StringRef(Sym1.CanonicalDeclaration.FileURI), "file:///path/foo.h"); EXPECT_EQ(Sym1.Origin, SymbolOrigin::Static); EXPECT_TRUE(Sym1.Flags & Symbol::IndexedForCodeCompletion); EXPECT_FALSE(Sym1.Flags & Symbol::Deprecated); @@ -122,7 +122,8 @@ TEST(SerializationTest, YAMLConversions) { EXPECT_THAT(Sym2, QName("clang::Foo2")); EXPECT_EQ(Sym2.Signature, "-sig"); EXPECT_EQ(Sym2.ReturnType, ""); - EXPECT_EQ(Sym2.CanonicalDeclaration.FileURI, "file:///path/bar.h"); + EXPECT_EQ(llvm::StringRef(Sym2.CanonicalDeclaration.FileURI), + "file:///path/bar.h"); EXPECT_FALSE(Sym2.Flags & Symbol::IndexedForCodeCompletion); EXPECT_TRUE(Sym2.Flags & Symbol::Deprecated); @@ -134,7 +135,7 @@ TEST(SerializationTest, YAMLConversions) { testing::SizeIs(1)))); auto Ref1 = ParsedYAML->Refs->begin()->second.front(); EXPECT_EQ(Ref1.Kind, RefKind::Reference); - EXPECT_EQ(Ref1.Location.FileURI, "file:///path/foo.cc"); + EXPECT_EQ(StringRef(Ref1.Location.FileURI), "file:///path/foo.cc"); } std::vector<std::string> YAMLFromSymbols(const SymbolSlab &Slab) { |

