[PATCH] D70489: [clangd] Add xref for macro to static index.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 3 13:40:04 PST 2019
hokein added a comment.
thanks, mostly good, my main concern is that the patch still relies on the `CollectMacro` and `CollectMainFileSymbols ` option, see my comments below.
================
Comment at: clang-tools-extra/clangd/index/SymbolCollector.cpp:349
SourceLocation Loc) {
if (!Opts.CollectMacro)
return true;
----------------
again, `CollectMacro` just tells whether we should collect macro symbols, we use `RefFilter` to control whether we collect macro references. I think we'd need to move this code after the code of collecting macro refs.
================
Comment at: clang-tools-extra/clangd/index/SymbolCollector.cpp:363
bool IsMainFileSymbol = SM.isInMainFile(SM.getExpansionLoc(DefLoc));
if (IsMainFileSymbol && !Opts.CollectMainFileSymbols)
return false;
----------------
and this as well.
================
Comment at: clang-tools-extra/clangd/index/SymbolCollector.cpp:472
}
- if (Opts.CollectMacro) {
- assert(PP);
----------------
this code should not be modified, since we don't use the `CollectMacro` option.
================
Comment at: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:615
+ CollectorOpts.CollectMacro = true;
+ CollectorOpts.CollectMainFileSymbols = true;
runSymbolCollector(Header.code(),
----------------
I think we don't need these flags if we change the symbolcollector as my other comments mention.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70489/new/
https://reviews.llvm.org/D70489
More information about the cfe-commits
mailing list