[clang-tools-extra] r373305 - [clangd] Handle OverloadExpr in targetDecl
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 1 00:27:55 PDT 2019
Author: ibiryukov
Date: Tue Oct 1 00:27:55 2019
New Revision: 373305
URL: http://llvm.org/viewvc/llvm-project?rev=373305&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/clangd/FindTarget.cpp
clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp
Modified: clang-tools-extra/trunk/clangd/FindTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FindTarget.cpp?rev=373305&r1=373304&r2=373305&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/FindTarget.cpp (original)
+++ clang-tools-extra/trunk/clangd/FindTarget.cpp Tue Oct 1 00:27:55 2019
@@ -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);
}
Modified: clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp?rev=373305&r1=373304&r2=373305&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp Tue Oct 1 00:27:55 2019
@@ -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(
More information about the cfe-commits
mailing list