hokein added a comment.

In https://reviews.llvm.org/D40897#946708, @malaperle wrote:

> Hi! Have you looked into https://reviews.llvm.org/D40548 ? Maybe we need to 
> coordinate the two a bit.


Hi Marc! Thanks for the input!

Yeah, Eric and I are working closely on a prototype of global code completion. 
We have implemented the initial version (see github 
<https://github.com/ioeric/clang-tools-extra/tree/clangd-code-completion-global-index>),
 and the prototype works well for LLVM project (even with a simple 
implementation), so we plan to split the patch, improve the code, and 
contribute it back to clangd repo incrementally.

For the prototype, we will load all symbols (without occurrences) into the 
memory, and build an in-memory index. From our experiment, the dataset of LLVM 
project in YAML format is ~120MB (~38,000 symbols), which is acceptable in 
clangd.

Our rough plan would be

1. Define the Symbol structure.
2. Design the interfaces of SymbolIndex, ASTIndex.
3. Combine 1) and 2) together to make global code completion work (we'd use 
YAML dataset for LLVM project, note that this is not a final solution, it would 
be hidden in an `--experimental` flag).
4. Switch to use the dataset from index-while-building when it is ready.



================
Comment at: clangd/Symbol.h:37
+// The class presents a C++ symbol, e.g. class, function.
+struct Symbol {
+  // The symbol identifier, using USR.
----------------
malaperle wrote:
> I think it would be nice to have methods as an interface to get this data 
> instead of storing them directly. So that an index-on-disk could go fetch the 
> data. Especially the occurrences which can take a lot of memory (I'm working 
> on a branch that does that). But perhaps defining that interface is not 
> within the scope of this patch and could be better discussed in D40548 ?
I agree. We can't load all the symbol occurrences into the memory since they 
are too large. We need to design interface for the symbol occurrences. 

We could discuss the interface here, but CodeCompletion is the main thing which 
this patch focuses on. 


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D40897



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to