if (Pref == Sema::CFP_WrongSide) {
// We have to do this odd dance to create our PartialDiagnostic because we
// want its storage to be allocated with operator new, not in an arena.
- PartialDiagnostic PD{PartialDiagnostic::NullDiagnostic()};
- PD.Reset(diag::err_ref_bad_target);
- PD << IdentifyCUDATarget(Callee) << Callee << IdentifyCUDATarget(Caller);
- Caller->addDeferredDiag({Loc, std::move(PD)});
- Diag(Callee->getLocation(), diag::note_previous_decl) << Callee;
+ PartialDiagnostic ErrPD{PartialDiagnostic::NullDiagnostic()};
+ ErrPD.Reset(diag::err_ref_bad_target);
+ ErrPD << IdentifyCUDATarget(Callee) << Callee << IdentifyCUDATarget(Caller);
+ Caller->addDeferredDiag({Loc, std::move(ErrPD)});
+
+ PartialDiagnostic NotePD{PartialDiagnostic::NullDiagnostic()};
+ NotePD.Reset(diag::note_previous_decl);
+ NotePD << Callee;
+ Caller->addDeferredDiag({Callee->getLocation(), std::move(NotePD)});
+
// This is not immediately an error, so return true. The deferred errors
// will be emitted if and when Caller is codegen'ed.
return true;
#include "Inputs/cuda.h"
__device__ void device_fn() {}
+// expected-note@-1 {{'device_fn' declared here}}
+// expected-note@-2 {{'device_fn' declared here}}
+// expected-note@-3 {{'device_fn' declared here}}
+// expected-note@-4 {{'device_fn' declared here}}
+// expected-note@-5 {{'device_fn' declared here}}
struct S {
__device__ S() {}
+ // expected-note@-1 {{'S' declared here}}
+ // expected-note@-2 {{'S' declared here}}
__device__ ~S() { device_fn(); }
+ // expected-note@-1 {{'~S' declared here}}
int x;
};
__host__ __device__ void hd3();
__device__ void d() {}
+ // expected-note@-1 {{'d' declared here}}
};
__host__ __device__ void T::hd3() {
#include "Inputs/cuda.h"
extern "C" void host_fn() {}
+// expected-note@-1 {{'host_fn' declared here}}
+// expected-note@-2 {{'host_fn' declared here}}
+// expected-note@-3 {{'host_fn' declared here}}
+// expected-note@-4 {{'host_fn' declared here}}
+// expected-note@-5 {{'host_fn' declared here}}
+// expected-note@-6 {{'host_fn' declared here}}
struct S {
S() {}
+ // expected-note@-1 {{'S' declared here}}
+ // expected-note@-2 {{'S' declared here}}
~S() { host_fn(); }
+ // expected-note@-1 {{'~S' declared here}}
int x;
};
__host__ __device__ void hd3();
void h() {}
+ // expected-note@-1 {{'h' declared here}}
};
__host__ __device__ void T::hd3() {