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)
commitbbc017851815da300ce9d6315204a73d68754a1c
treef111ef9bcd2b50a00395b8fbd7a1c70751c6dcba
parentd34e4d235428e13810d695400e5a14f5b8752c13
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

llvm-svn: 223271
clang/include/clang/Basic/LangOptions.def
clang/lib/Basic/Targets.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Sema/SemaCUDA.cpp
clang/test/SemaCUDA/function-target.cu