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/clangd/index/SymbolCollector.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/clangd/index/SymbolCollector.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/index/SymbolCollector.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index d1d4f0924bd..1911c150a2a 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -225,7 +225,7 @@ Optional<SymbolLocation> getTokenLocation(SourceLocation TokLoc, return None; FileURIStorage = std::move(*U); SymbolLocation Result; - Result.FileURI = FileURIStorage; + Result.FileURI = FileURIStorage.c_str(); auto Range = getTokenRange(TokLoc, SM, LangOpts); Result.Start = Range.first; Result.End = Range.second; @@ -524,7 +524,7 @@ void SymbolCollector::finish() { Ref R; R.Location.Start = Range.first; R.Location.End = Range.second; - R.Location.FileURI = *FileURI; + R.Location.FileURI = FileURI->c_str(); R.Kind = toRefKind(LocAndRole.second); Refs.insert(*ID, R); } |

