[PATCH] D77715: [clangd] Add missing GoToStmt in FindTarget.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 8 05:25:00 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa533b03028fa: [clangd] Add missing GoToStmt in FindTarget. (authored by hokein).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77715/new/
https://reviews.llvm.org/D77715
Files:
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -130,6 +130,22 @@
}
)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) {
Index: clang-tools-extra/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -331,6 +331,14 @@
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77715.255987.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200408/4f97744d/attachment.bin>
More information about the cfe-commits
mailing list