]> granicus.if.org Git - clang/commit
[CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIf{Device,Host}Code().
authorJustin Lebar <jlebar@google.com>
Thu, 13 Oct 2016 18:45:08 +0000 (18:45 +0000)
committerJustin Lebar <jlebar@google.com>
Thu, 13 Oct 2016 18:45:08 +0000 (18:45 +0000)
commitfff8e6c7b6f6f8ebc8c9d8e8282e2f12d1fa565a
tree881c2029e0f0447633b38362353700ac723ee8bd
parentd1494637bbb364bbf5bdb753e668c0323e4ec67b
[CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIf{Device,Host}Code().

Summary:
Together these let you easily create diagnostics that

 - are never emitted for host code
 - are always emitted for __device__ and __global__ functions, and
 - are emitted for __host__ __device__ functions iff these functions are
   codegen'ed.

At the moment there are only three diagnostics that need this treatment,
but I have more to add, and it's not sustainable to write code for emitting
every such diagnostic twice, and from a special wrapper in SemaCUDA.cpp.

While we're at it, don't emit the function name in
err_cuda_device_exceptions: It's not necessary to print it, and making
this work in the new framework in the face of a null value for
dyn_cast<FunctionDecl>(CurContext) isn't worth the effort.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25139

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284143 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaCUDA.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaStmt.cpp
lib/Sema/SemaType.cpp
test/SemaCUDA/exceptions-host-device.cu
test/SemaCUDA/exceptions.cu