[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 07:02:35 PDT 2020
kadircet added a comment.
we should also be handling `LabelDecl`s in clang/lib/Index/IndexDecl.cpp
================
Comment at: clang/lib/Index/IndexBody.cpp:145
+ if (auto *LabelDecl = Goto->getLabel())
+ IndexCtx.handleReference(LabelDecl, Goto->getLabelLoc(), Parent, ParentDC,
+ static_cast<unsigned>(SymbolRole::Reference));
----------------
this should propagate the result from handleReference, i.e `return IndexCtx.handleRefer...`.
================
Comment at: clang/lib/Index/IndexBody.cpp:146
+ IndexCtx.handleReference(LabelDecl, Goto->getLabelLoc(), Parent, ParentDC,
+ static_cast<unsigned>(SymbolRole::Reference));
+ return true;
----------------
s/unsigned/SymbolRoleSet
================
Comment at: clang/lib/Index/IndexBody.cpp:154
+ ParentDC,
+ static_cast<unsigned>(SymbolRole::Reference));
+ return true;
----------------
the two comments above also applies to this one.
================
Comment at: clang/unittests/Index/IndexTests.cpp:355
+ EXPECT_THAT(Index->Symbols,
+ Not(Contains(AllOf(QName("label"), HasRole(SymbolRole::Reference),
+ WrittenAt(Position(3, 5))))));
----------------
nit: just Not(Contains(QName("label"))
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