Author: jlebar Date: Tue Aug 9 20:09:18 2016 New Revision: 278195 URL: http://llvm.org/viewvc/llvm-project?rev=278195&view=rev Log: [CUDA] Print a "previous-decl" note when calling an illegal member fn.
Summary: When we emit err_ref_bad_target, we should emit a "'method' declared here" note. We already do so in most places, just not in BuildCallToMemberFunction. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23240 Modified: cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/test/SemaCUDA/method-target.cu Modified: cfe/trunk/lib/Sema/SemaOverload.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=278195&r1=278194&r2=278195&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaOverload.cpp (original) +++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Aug 9 20:09:18 2016 @@ -12334,6 +12334,7 @@ Sema::BuildCallToMemberFunction(Scope *S Diag(MemExpr->getMemberLoc(), diag::err_ref_bad_target) << IdentifyCUDATarget(Method) << Method->getIdentifier() << IdentifyCUDATarget(Caller); + Diag(Method->getLocation(), diag::note_previous_decl) << Method; return ExprError(); } } Modified: cfe/trunk/test/SemaCUDA/method-target.cu URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/method-target.cu?rev=278195&r1=278194&r2=278195&view=diff ============================================================================== --- cfe/trunk/test/SemaCUDA/method-target.cu (original) +++ cfe/trunk/test/SemaCUDA/method-target.cu Tue Aug 9 20:09:18 2016 @@ -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 @@ __device__ void foo2(S2& s, int i, float // 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 @@ __device__ void foo5(S5& s, S5& t) { // Test 6: call method through pointer struct S6 { - void method() {} + void method() {} // expected-note {{'method' declared here}}; }; __device__ void foo6(S6* s) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits