[CUDA] Do a better job at detecting wrong-side calls.
Summary: Move CheckCUDACall from ActOnCallExpr and BuildDeclRefExpr to DiagnoseUseOfDecl. This lets us catch some edge cases we were missing, specifically around class operators. This necessitates a few other changes: - Avoid emitting duplicate deferred diags in CheckCUDACall. Previously we'd carefully placed our call to CheckCUDACall such that it would only ever run once for a particular callsite. But now this isn't the case. - Emit deferred diagnostics from a template specialization/instantiation's primary template, in addition to from the specialization/instantiation itself. DiagnoseUseOfDecl ends up putting the deferred diagnostics on the template, rather than the specialization, so we need to check both. Reviewers: rsmith Subscribers: cfe-commits, tra Differential Revision: https://reviews.llvm.org/D24573 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283637 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Sema/Sema.h 17 additions, 6 deletionsinclude/clang/Sema/Sema.h
- lib/CodeGen/CodeGenModule.cpp 4 additions, 0 deletionslib/CodeGen/CodeGenModule.cpp
- lib/Sema/SemaCUDA.cpp 7 additions, 1 deletionlib/Sema/SemaCUDA.cpp
- lib/Sema/SemaExpr.cpp 49 additions, 71 deletionslib/Sema/SemaExpr.cpp
- test/SemaCUDA/Inputs/cuda.h 3 additions, 1 deletiontest/SemaCUDA/Inputs/cuda.h
- test/SemaCUDA/call-host-fn-from-device.cu 39 additions, 0 deletionstest/SemaCUDA/call-host-fn-from-device.cu
Loading
Please register or sign in to comment