[clang-tools-extra] Extend call hierarchy for field and non-local variables (PR #113900)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 09:33:18 PDT 2024


================
@@ -2238,7 +2238,10 @@ prepareCallHierarchy(ParsedAST &AST, Position Pos, PathRef TUPath) {
   for (const NamedDecl *Decl : getDeclAtPosition(AST, *Loc, {})) {
     if (!(isa<DeclContext>(Decl) &&
           cast<DeclContext>(Decl)->isFunctionOrMethod()) &&
-        Decl->getKind() != Decl::Kind::FunctionTemplate)
+        !(Decl->getKind() == Decl::Kind::Var &&
+          !cast<VarDecl>(Decl)->isLocalVarDecl()) &&
+        Decl->getKind() != Decl::Kind::FunctionTemplate &&
----------------
timon-ul wrote:

Allright, I initially put them apart because I thought this arrangement was easier to read, but I understand why it makes sense to keep it there.

https://github.com/llvm/llvm-project/pull/113900


More information about the cfe-commits mailing list