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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 20 02:56:44 PDT 2018


hokein added inline comments.
Herald added a subscriber: kadircet.


================
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);
----------------
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`).  


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50889





More information about the cfe-commits mailing list