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);
|
Finder.add(CCI, Flags);
|
||||||
else if (const TemplateArgumentLoc *TAL = N.get<TemplateArgumentLoc>())
|
else if (const TemplateArgumentLoc *TAL = N.get<TemplateArgumentLoc>())
|
||||||
Finder.add(TAL->getArgument(), Flags);
|
Finder.add(TAL->getArgument(), Flags);
|
||||||
|
else if (const CXXBaseSpecifier *CBS = N.get<CXXBaseSpecifier>())
|
||||||
|
Finder.add(CBS->getTypeSourceInfo()->getType(), Flags);
|
||||||
return Finder.takeDecls();
|
return Finder.takeDecls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,24 @@ TEST_F(TargetDeclTest, UsingDecl) {
|
||||||
{"void waldo()"});
|
{"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) {
|
TEST_F(TargetDeclTest, ConstructorInitList) {
|
||||||
Code = R"cpp(
|
Code = R"cpp(
|
||||||
struct X {
|
struct X {
|
||||||
|
|
Loading…
Reference in New Issue