[PATCH] D41345: [clangd] Add more symbol information for code completion.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 20 09:32:24 PST 2017


sammccall added inline comments.


================
Comment at: clangd/index/Index.h:105
+  /// What to insert when completing this symbol (plain text version).
+  std::string CompletionPlainInsertText;
+  /// What to insert when completing this symbol (snippet version).
----------------
insert texts can be in details I think? They're not required for completion until after resolve.


================
Comment at: clangd/index/Index.h:122
+
+  llvm::Optional<Details> Detail;
+
----------------
I think you probably want a raw pointer rather than optional:
 - reduce the size of the struct when it's absent
 - make it inheritance-friendly so we can hang index-specific info off it
(raw pointer rather than unique_ptr because it's owned by a slab not by malloc, but unique_ptr is ok for now)



================
Comment at: clangd/index/SymbolCollector.cpp:65
+  CodeCompletionResult SymbolCompletion(ND, 0);
+  auto Allocator = std::make_shared<GlobalCodeCompletionAllocator>();
+  CodeCompletionTUInfo TUInfo(Allocator);
----------------
this doesn't seem like the kind of thing we should be allocating per-symbol!
You can use a single one and Reset() it, I think

also why globalcodecompletionallocator, vs just codecompletionallocator?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41345





More information about the cfe-commits mailing list