[PATCH] D94424: [clangd] Make AST-based signals available to runWithPreamble.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 14 08:26:35 PST 2021


sammccall accepted this revision.
sammccall added a comment.

Thanks!



================
Comment at: clang-tools-extra/clangd/ASTSignals.cpp:9
+  ASTSignals Signals;
+  llvm::DenseMap<const NamespaceDecl *, llvm::DenseSet<SymbolID>> NSDToSymbols;
+  const SourceManager &SM = AST.getSourceManager();
----------------
this requires storing all the SymbolIDs again.

You could just have a counter instead. The trick is that you're already counting the number of times a symbol has been seen...

```
unsigned &SymbolCount = Signals.ReferencedSymbols[ID];
++SymbolCount;
if (SymbolCount == 1) { // first time seeing the symbol
  // increment counter for its namespace
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94424/new/

https://reviews.llvm.org/D94424



More information about the cfe-commits mailing list