[clangd] Handle OverloadExpr in targetDecl

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68119

llvm-svn: 373305
This commit is contained in:
Ilya Biryukov 2019-10-01 07:27:55 +00:00
parent d1337ec22d
commit a160a0ba53
2 changed files with 30 additions and 0 deletions

View File

@ -189,6 +189,10 @@ public:
D = USD;
Outer.add(D, Flags);
}
void VisitOverloadExpr(const OverloadExpr *OE) {
for (auto *D : OE->decls())
Outer.add(D, Flags);
}
void VisitCXXConstructExpr(const CXXConstructExpr *CCE) {
Outer.add(CCE->getConstructor(), Flags);
}

View File

@ -393,6 +393,32 @@ TEST_F(TargetDeclTest, Lambda) {
EXPECT_DECLS("DeclRefExpr", "auto int x = 1");
}
TEST_F(TargetDeclTest, OverloadExpr) {
Code = R"cpp(
void func(int*);
void func(char*);
template <class T>
void foo(T t) {
[[func]](t);
};
)cpp";
EXPECT_DECLS("UnresolvedLookupExpr", "void func(int *)", "void func(char *)");
Code = R"cpp(
struct X {
void func(int*);
void func(char*);
};
template <class T>
void foo(X x, T t) {
x.[[func]](t);
};
)cpp";
EXPECT_DECLS("UnresolvedMemberExpr", "void func(int *)", "void func(char *)");
}
TEST_F(TargetDeclTest, ObjC) {
Flags = {"-xobjective-c"};
Code = R"cpp(