summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCUDA.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-19 21:03:38 +0000
committerJustin Lebar <jlebar@google.com>2016-10-19 21:03:38 +0000
commit9730ae943f3c639f9d0798a1319b4adc6d3deafc (patch)
tree5bb90b7acddcac1aa1304719ff4c6e5e055a79a6 /clang/lib/Sema/SemaCUDA.cpp
parentcdd6da83a69c895711b62f306c7ca8ccda453662 (diff)
downloadbcm5719-llvm-9730ae943f3c639f9d0798a1319b4adc6d3deafc.tar.gz
bcm5719-llvm-9730ae943f3c639f9d0798a1319b4adc6d3deafc.zip
[CUDA] Emit errors for wrong-side calls made on the same line as non-wrong-side calls.
Summary: This fixes two related bugs: 1) Previously, if you had a non-wrong side call at some source code location L, we wouldn't emit errors for wrong-side calls that appeared at L. 2) We'd only emit one wrong-side error per source code location, when we actually want to emit it twice if we hit this line more than once due to e.g. template instantiation. Reviewers: tra Subscribers: rnk, cfe-commits Differential Revision: https://reviews.llvm.org/D25702 llvm-svn: 284643
Diffstat (limited to 'clang/lib/Sema/SemaCUDA.cpp')
-rw-r--r--clang/lib/Sema/SemaCUDA.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp
index 75ec5f2bbf3..423aef370ba 100644
--- a/clang/lib/Sema/SemaCUDA.cpp
+++ b/clang/lib/Sema/SemaCUDA.cpp
@@ -714,20 +714,22 @@ bool Sema::CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee) {
}
}();
+ if (DiagKind == CUDADiagBuilder::K_Nop)
+ return true;
+
// Avoid emitting this error twice for the same location. Using a hashtable
// like this is unfortunate, but because we must continue parsing as normal
// after encountering a deferred error, it's otherwise very tricky for us to
// ensure that we only emit this deferred error once.
- if (!LocsWithCUDACallDiags.insert(Loc.getRawEncoding()).second)
+ if (!LocsWithCUDACallDiags.insert({Caller, Loc.getRawEncoding()}).second)
return true;
- bool IsImmediateErr =
- CUDADiagBuilder(DiagKind, Loc, diag::err_ref_bad_target, Caller, *this)
+ CUDADiagBuilder(DiagKind, Loc, diag::err_ref_bad_target, Caller, *this)
<< IdentifyCUDATarget(Callee) << Callee << IdentifyCUDATarget(Caller);
CUDADiagBuilder(DiagKind, Callee->getLocation(), diag::note_previous_decl,
Caller, *this)
<< Callee;
- return !IsImmediateErr;
+ return DiagKind != CUDADiagBuilder::K_Immediate;
}
void Sema::CUDASetLambdaAttrs(CXXMethodDecl *Method) {
OpenPOWER on IntegriCloud