]> granicus.if.org Git - clang/commit
[CUDA] Do a better job at detecting wrong-side calls.
authorJustin Lebar <jlebar@google.com>
Sat, 8 Oct 2016 01:07:11 +0000 (01:07 +0000)
committerJustin Lebar <jlebar@google.com>
Sat, 8 Oct 2016 01:07:11 +0000 (01:07 +0000)
commit14cbb5eee546e7d3158ce36a0da39bcd16dc1fb8
treee5555ff3a9de4e286b8dcb940d39b355e063209e
parentb7ca92a02c15979c5fe7585b2fd053dd04405c07
[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
include/clang/Sema/Sema.h
lib/CodeGen/CodeGenModule.cpp
lib/Sema/SemaCUDA.cpp
lib/Sema/SemaExpr.cpp
test/SemaCUDA/Inputs/cuda.h
test/SemaCUDA/call-host-fn-from-device.cu