]> granicus.if.org Git - clang/commit
CUDA host device code with two code paths
authorReid Kleckner <reid@kleckner.net>
Wed, 3 Dec 2014 21:53:36 +0000 (21:53 +0000)
committerReid Kleckner <reid@kleckner.net>
Wed, 3 Dec 2014 21:53:36 +0000 (21:53 +0000)
commit3dadd70fc264f3725168d6b9a301dfc0ae85537e
treebd2aef8787550e42e6e44afab9cd42455689589e
parent70d0d3c4beaec6dd2ae0c19a6a8b76e57ecb17fe
CUDA host device code with two code paths

Summary:
Allow CUDA host device functions with two code paths using __CUDA_ARCH__
to differentiate between code path being compiled.

For example:
  __host__ __device__ void host_device_function(void) {
  #ifdef __CUDA_ARCH__
    device_only_function();
  #else
    host_only_function();
  #endif
  }

Patch by Jacques Pienaar.

Reviewed By: rnk

Differential Revision: http://reviews.llvm.org/D6457

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223271 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/LangOptions.def
lib/Basic/Targets.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/InitPreprocessor.cpp
lib/Sema/SemaCUDA.cpp
test/SemaCUDA/function-target.cu