[PATCH] D84839: Add document outline symbols from unnamed contexts, e.g. extern "C".
Ilya Golovenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 29 07:07:09 PDT 2020
ilya-golovenko added inline comments.
================
Comment at: clang-tools-extra/clangd/FindSymbols.cpp:200
auto *ND = llvm::dyn_cast<NamedDecl>(D);
- if (!ND)
+ if (!ND) {
+ // Traverse children of unnamed contexts, e.g. extern "C".
----------------
kadircet wrote:
> this will result in traversal of other declcontexts like block/capturedecls.
>
> i think we should rather change the VisitKind to `{No, Decl, Children}` and then make `shouldVisit` return a `VisitKindSet` and take a `Decl*` instead of a `NamedDecl`.
> Later on we should first check for `LinkageSpecDecl` and return `Children` only while keeping the rest of the logic the same (i.e. try to cast to nameddecl and return `No` if it fails.
> Finally logic in here should also be adjusted accordingly to visit children and the decl itself separately.
>
> Do you have other cases apart from extern'd symbols?
I have only C++20 `ExportDecl` in mind. Initially I wanted to make changes similar like you propose, but tried to minimize the diff :-) I will re-work the fix according to your proposal.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84839/new/
https://reviews.llvm.org/D84839
More information about the cfe-commits
mailing list