[PATCH] D77717: [clang][index] index the missing LabelDecl in libindex.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 22:07:36 PDT 2020


kadircet added inline comments.


================
Comment at: clang/lib/Index/IndexBody.cpp:152
+    if (auto *LabelDecl = Label->getDecl())
+      IndexCtx.handleReference(LabelDecl, Label->getIdentLoc(), Parent,
+                               ParentDC,
----------------
argh, looks like RecursiveASTVisitor doesn't traverse LabelDecl inside the LabelStmt. So feel free to fix that in RAV or call `IndexCtx.handleDecl(LabelDecl)` in here with a fixme. (hopefully nothing much should break with the former though)


================
Comment at: clang/unittests/Index/IndexTests.cpp:349
+  EXPECT_THAT(Index->Symbols,
+              Contains(AllOf(QName("label"), HasRole(SymbolRole::Reference),
+                             WrittenAt(Position(3, 5)))));
----------------
i believe we should see the "definition/declaration" of `label` rather than a reference


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77717/new/

https://reviews.llvm.org/D77717





More information about the cfe-commits mailing list