[PATCH] D68119: [clangd] Handle OverloadExpr in targetDecl

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 1 00:27:14 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL373305: [clangd] Handle OverloadExpr in targetDecl (authored by ibiryukov, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D68119?vs=222083&id=222552#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68119/new/

https://reviews.llvm.org/D68119

Files:
  clang-tools-extra/trunk/clangd/FindTarget.cpp
  clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp


Index: clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp
@@ -393,6 +393,32 @@
   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(
Index: clang-tools-extra/trunk/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/FindTarget.cpp
+++ clang-tools-extra/trunk/clangd/FindTarget.cpp
@@ -189,6 +189,10 @@
           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);
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68119.222552.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191001/b4674ede/attachment-0001.bin>


More information about the cfe-commits mailing list