[PATCH] D84839: Add document outline symbols from unnamed contexts, e.g. extern "C".

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 29 05:57:52 PDT 2020


kadircet 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".
----------------
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?


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