forked from OSchip/llvm-project
[clangd] FindTarget resolves base specifier
FindTarget on the virtual keyword or access specifier of a base specifier will now resolve to type of the base specifier. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D95338
This commit is contained in:
parent
d92413a45e
commit
7730599c41
|
@ -710,7 +710,8 @@ allTargetDecls(const DynTypedNode &N) {
|
|||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -230,6 +230,24 @@ TEST_F(TargetDeclTest, UsingDecl) {
|
|||
{"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 {
|
||||
|
|
Loading…
Reference in New Issue