This is an archive of the discontinued LLVM Phabricator instance.

[clang][index] index the missing LabelDecl in libindex.
Needs ReviewPublic

Authored by hokein on Apr 8 2020, 4:23 AM.

Details

Reviewers
kadircet

Diff Detail

Event Timeline

hokein created this revision.Apr 8 2020, 4:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2020, 4:23 AM
Herald added a subscriber: arphaman. · View Herald Transcript
hokein updated this revision to Diff 256001.Apr 8 2020, 6:28 AM

add a clangd xref test.

we should also be handling LabelDecls in clang/lib/Index/IndexDecl.cpp

clang/lib/Index/IndexBody.cpp
145

this should propagate the result from handleReference, i.e return IndexCtx.handleRefer....

146

s/unsigned/SymbolRoleSet

154

the two comments above also applies to this one.

clang/unittests/Index/IndexTests.cpp
355

nit: just Not(Contains(QName("label"))

kadircet added inline comments.Apr 8 2020, 9:55 PM
clang/lib/Index/IndexBody.cpp
152

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)

clang/unittests/Index/IndexTests.cpp
349

i believe we should see the "definition/declaration" of label rather than a reference