diff options
author | Justin Lebar <jlebar@google.com> | 2016-08-16 00:48:21 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-08-16 00:48:21 +0000 |
commit | 26bb31123aeb97024c425de8e9688b4c991941fb (patch) | |
tree | 390b4c6b49736174ed3b82496de90a2fdc1e6fe1 /clang/lib/Sema/SemaCUDA.cpp | |
parent | acc50c433422106bbabe97ef91a065075e2a7a29 (diff) | |
download | llvm-26bb31123aeb97024c425de8e9688b4c991941fb.zip llvm-26bb31123aeb97024c425de8e9688b4c991941fb.tar.gz llvm-26bb31123aeb97024c425de8e9688b4c991941fb.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Sema/SemaCUDA.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCUDA.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
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 @@ bool Sema::CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee) { 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; |