Summary: so that go-to-def on label can work.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77715
break;
}
}
+ void VisitGotoStmt(const GotoStmt *Goto) {
+ if (auto *LabelDecl = Goto->getLabel())
+ Outer.add(LabelDecl, Flags);
+ }
+ void VisitLabelStmt(const LabelStmt *Label) {
+ if (auto *LabelDecl = Label->getDecl())
+ Outer.add(LabelDecl, Flags);
+ }
void
VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *E) {
const Type *BaseType = E->getBaseType().getTypePtrOrNull();
}
)cpp";
EXPECT_DECLS("CXXOperatorCallExpr", "void operator()(int n)");
+
+ Code = R"cpp(
+ void test() {
+ goto [[label]];
+ label:
+ return;
+ }
+ )cpp";
+ EXPECT_DECLS("GotoStmt", "label:");
+ Code = R"cpp(
+ void test() {
+ [[label]]:
+ return;
+ }
+ )cpp";
+ EXPECT_DECLS("LabelStmt", "label:");
}
TEST_F(TargetDeclTest, Recovery) {