[PATCH] D50889: [clangd] Make FileIndex aware of the main file

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 21 07:43:20 PDT 2018


ilya-biryukov marked an inline comment as done.
ilya-biryukov added inline comments.


================
Comment at: clangd/index/FileIndex.h:70
+  void
+  update(PathRef Path, ASTContext *AST, std::shared_ptr<Preprocessor> PP,
+         llvm::Optional<llvm::ArrayRef<Decl *>> TopLevelDecls = llvm::None);
----------------
hokein wrote:
> Any strong reason to unify the interface (and `indexAST`)? 
> 
> It seems to me that we do different things on `PreambleAST` and `MainAST`:
> 
> - on `PreambleAST`, we only index `Symbols` for code completion.
> - on `MainAST`, we index `Symbols` (to collect other information missing from `PreambleAST`, e.g. definition location), and collect symbol references.
> 
> Therefore, we'd need to set different options for `SymbolCollector` accordingly. Having a single interface would make the implementation tricky (checking `TopLevelDecls` to see whether this is a `PreambleASt`).  
The only reason is to keep the changes to `FileIndex` minimal in this change. We'll have to change more code to cover those differences, but I'm not sure I have enough context on what's going to be different for this change, a change that will plug xrefs into clangd is probably a better candidate for those.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50889





More information about the cfe-commits mailing list