[PATCH] D53427: [clangd] Replace StringRef in SymbolLocation with a char pointer.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 14 05:31:35 PST 2018


alexfh added inline comments.


================
Comment at: clang-tools-extra/trunk/clangd/index/Index.h:71
+  // via llvm::StringRef.
+  const char *FileURI = "";
 };
----------------
If the users of the SymbolLocation have a way to get a common "context", you could keep a list of filenames in this context and just store an index into this list (which could be even shorter). If the structure is used where no context is available, you could still keep a list of StringRefs somewhere (probably close to where the string data pointed by the StringRefs lives) and keep a `StringRef *` here. At a cost of one indirection you'd avoid calling strlen.

Not sure what trade-off is better for this particular use case though.


Repository:
  rL LLVM

https://reviews.llvm.org/D53427





More information about the cfe-commits mailing list