[PATCH] D23240: [CUDA] Print a "previous-decl" note when calling an illegal member fn.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 18:17:16 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL278195: [CUDA] Print a "previous-decl" note when calling an illegal member fn. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D23240?vs=67081&id=67448#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23240

Files:
  cfe/trunk/lib/Sema/SemaOverload.cpp
  cfe/trunk/test/SemaCUDA/method-target.cu

Index: cfe/trunk/lib/Sema/SemaOverload.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp
+++ cfe/trunk/lib/Sema/SemaOverload.cpp
@@ -12334,6 +12334,7 @@
         Diag(MemExpr->getMemberLoc(), diag::err_ref_bad_target)
             << IdentifyCUDATarget(Method) << Method->getIdentifier()
             << IdentifyCUDATarget(Caller);
+        Diag(Method->getLocation(), diag::note_previous_decl) << Method;
         return ExprError();
       }
     }
Index: cfe/trunk/test/SemaCUDA/method-target.cu
===================================================================
--- cfe/trunk/test/SemaCUDA/method-target.cu
+++ cfe/trunk/test/SemaCUDA/method-target.cu
@@ -6,7 +6,7 @@
 // Test 1: host method called from device function
 
 struct S1 {
-  void method() {}
+  void method() {} // expected-note {{'method' declared here}}
 };
 
 __device__ void foo1(S1& s) {
@@ -29,7 +29,7 @@
 // Test 3: device method called from host function
 
 struct S3 {
-  __device__ void method() {}
+  __device__ void method() {} // expected-note {{'method' declared here}};
 };
 
 void foo3(S3& s) {
@@ -63,7 +63,7 @@
 // Test 6: call method through pointer
 
 struct S6 {
-  void method() {}
+  void method() {} // expected-note {{'method' declared here}};
 };
 
 __device__ void foo6(S6* s) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23240.67448.patch
Type: text/x-patch
Size: 1336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160810/29bcd20a/attachment-0001.bin>


More information about the cfe-commits mailing list