[PATCH] D95338: [clangd] FindTarget resolves base specifier
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 25 04:57:50 PST 2021
njames93 updated this revision to Diff 318968.
njames93 added a comment.
Remove unintended formatting change.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95338/new/
https://reviews.llvm.org/D95338
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
@@ -230,6 +230,24 @@
{"void waldo()"});
}
+TEST_F(TargetDeclTest, BaseSpecifier) {
+ Code = R"cpp(
+ struct X {};
+ struct Y : [[private]] X {};
+ )cpp";
+ EXPECT_DECLS("CXXBaseSpecifier", "struct X");
+ Code = R"cpp(
+ struct X {};
+ struct Y : [[private X]] {};
+ )cpp";
+ EXPECT_DECLS("CXXBaseSpecifier", "struct X");
+ Code = R"cpp(
+ struct X {};
+ struct Y : private [[X]] {};
+ )cpp";
+ EXPECT_DECLS("RecordTypeLoc", "struct X");
+}
+
TEST_F(TargetDeclTest, ConstructorInitList) {
Code = R"cpp(
struct X {
Index: clang-tools-extra/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -710,7 +710,8 @@
Finder.add(CCI, Flags);
else if (const TemplateArgumentLoc *TAL = N.get<TemplateArgumentLoc>())
Finder.add(TAL->getArgument(), Flags);
-
+ else if (const CXXBaseSpecifier *CBS = N.get<CXXBaseSpecifier>())
+ Finder.add(CBS->getTypeSourceInfo()->getType(), Flags);
return Finder.takeDecls();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95338.318968.patch
Type: text/x-patch
Size: 1354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210125/fb6b07eb/attachment.bin>
More information about the cfe-commits
mailing list