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/CodeCompleteTests.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/CodeCompleteTests.cpp')
| -rw-r--r-- | clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp index b1e164dad07..e88fd087cd2 100644 --- a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp +++ b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp @@ -583,7 +583,7 @@ TEST(CompletionTest, IncludeInsertionPreprocessorIntegrationTests) { ClangdServer Server(CDB, FS, DiagConsumer, ClangdServer::optsForTest()); auto BarURI = URI::createFile(BarHeader).toString(); Symbol Sym = cls("ns::X"); - Sym.CanonicalDeclaration.FileURI = BarURI; + Sym.CanonicalDeclaration.FileURI = BarURI.c_str(); Sym.IncludeHeaders.emplace_back(BarURI, 1); // Shoten include path based on search dirctory and insert. auto Results = completions(Server, @@ -614,8 +614,8 @@ TEST(CompletionTest, NoIncludeInsertionWhenDeclFoundInFile) { Symbol SymY = cls("ns::Y"); std::string BarHeader = testPath("bar.h"); auto BarURI = URI::createFile(BarHeader).toString(); - SymX.CanonicalDeclaration.FileURI = BarURI; - SymY.CanonicalDeclaration.FileURI = BarURI; + SymX.CanonicalDeclaration.FileURI = BarURI.c_str(); + SymY.CanonicalDeclaration.FileURI = BarURI.c_str(); SymX.IncludeHeaders.emplace_back("<bar>", 1); SymY.IncludeHeaders.emplace_back("<bar>", 1); // Shoten include path based on search dirctory and insert. @@ -1252,7 +1252,7 @@ TEST(CompletionTest, OverloadBundling) { // Differences in header-to-insert suppress bundling. std::string DeclFile = URI::createFile(testPath("foo")).toString(); - NoArgsGFunc.CanonicalDeclaration.FileURI = DeclFile; + NoArgsGFunc.CanonicalDeclaration.FileURI = DeclFile.c_str(); NoArgsGFunc.IncludeHeaders.emplace_back("<foo>", 1); EXPECT_THAT( completions(Context + "int y = GFunc^", {NoArgsGFunc}, Opts).Completions, @@ -1959,7 +1959,7 @@ TEST(CompletionTest, EnableSpeculativeIndexRequest) { TEST(CompletionTest, InsertTheMostPopularHeader) { std::string DeclFile = URI::createFile(testPath("foo")).toString(); Symbol sym = func("Func"); - sym.CanonicalDeclaration.FileURI = DeclFile; + sym.CanonicalDeclaration.FileURI = DeclFile.c_str(); sym.IncludeHeaders.emplace_back("\"foo.h\"", 2); sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000); @@ -1981,7 +1981,7 @@ TEST(CompletionTest, NoInsertIncludeIfOnePresent) { std::string DeclFile = URI::createFile(testPath("foo")).toString(); Symbol sym = func("Func"); - sym.CanonicalDeclaration.FileURI = DeclFile; + sym.CanonicalDeclaration.FileURI = DeclFile.c_str(); sym.IncludeHeaders.emplace_back("\"foo.h\"", 2); sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000); |

