sammccall added a comment.

Nice fix, just performance concerns.

(I do think this might be significant, but measuring dynamic index time 
before/after for a big TU might show this to be unimportant)



================
Comment at: clangd/index/SymbolCollector.cpp:348
 
+  if (!shouldCollectSymbol(*ND, *ASTCtx, Opts))
+    return true;
----------------
This seems better for the main-AST case, but substantially more expensive for 
indexing preambles: we may not want references at all, so paying for 
shouldCollectSymbol for every reference seems wasteful.

what about
```
bool RefMayBeInteresting = RefFilter & Roles;
bool IsOnlyRef = !(Roles & (Declaration | Definition));
if (IsOnlyRef && !RefMayBeInteresting)
  return;
if (!shouldCollectSymbol())
  return;
if (RefMayBeInteresting && File == getMainFileID())
  // add ref
if (IsOnlyRef) // don't continue if mere reference
  return;
```



Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53273



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

Reply via email to