[PATCH] D46751: [clangd] Filter out private proto symbols in SymbolCollector.
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 16 03:15:15 PDT 2018
ioeric added inline comments.
================
Comment at: clangd/index/SymbolCollector.cpp:101
+// we check whether it starts with PROTO_HEADER_COMMENT.
+bool isPrivateProtoSymbol(const NamedDecl &ND) {
+ const auto &SM = ND.getASTContext().getSourceManager();
----------------
sammccall wrote:
> We're going to end up calling this code on every decl/def we see.
> Am I being paranoid by thinking we should check whether the file is a proto once, rather than doing a bunch of string matching every time?
`s/Symbol/Decl/`
We could store a cache in the symbol collector (just need to add another state in the class, remember to invalidate for a new ASTContext, make this a member etc), but I think the matching is cheap enough?
================
Comment at: clangd/index/SymbolCollector.cpp:112
+
+ auto Name = ND.getName();
+ if (!Name.contains('_'))
----------------
sammccall wrote:
> this asserts if the name is not a simple identifier (Maybe operators or something will trigger this?).
Good catch!
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D46751
More information about the cfe-commits
mailing list