[CUDA] Fix "declared here" note on deferred wrong-side errors.
Previously we weren't deferring these "declared here" notes, which is
obviously wrong.
llvm-svn: 278767
diff --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp
index 4f370d3..6f94e54 100644
--- a/clang/lib/Sema/SemaCUDA.cpp
+++ b/clang/lib/Sema/SemaCUDA.cpp
@@ -499,11 +499,16 @@
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;