diff options
author | Justin Lebar <jlebar@google.com> | 2016-01-20 00:26:57 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-01-20 00:26:57 +0000 |
commit | c66a10652a9404d1d196864fc1b2e9aa413307b8 (patch) | |
tree | 232fcbb0030c005f33eb22a12210d739dfc22dad /clang/lib/Sema/SemaCUDA.cpp | |
parent | 23c4d83aa310903484cb80d2ab8197444a96d2e0 (diff) | |
download | llvm-c66a10652a9404d1d196864fc1b2e9aa413307b8.zip llvm-c66a10652a9404d1d196864fc1b2e9aa413307b8.tar.gz llvm-c66a10652a9404d1d196864fc1b2e9aa413307b8.tar.bz2 |
[CUDA] Only allow __global__ on free functions and static member functions.
Summary:
Warn for NVCC compatibility if you declare a static member function or
inline function as __global__.
Reviewers: tra
Subscribers: jhen, echristo, cfe-commits
Differential Revision: http://reviews.llvm.org/D16261
llvm-svn: 258263
Diffstat (limited to 'clang/lib/Sema/SemaCUDA.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCUDA.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp index 61dfdd3..568c765 100644 --- a/clang/lib/Sema/SemaCUDA.cpp +++ b/clang/lib/Sema/SemaCUDA.cpp @@ -273,12 +273,9 @@ static bool resolveCalleeCUDATargetConflict(Sema::CUDAFunctionTarget Target1, Sema::CUDAFunctionTarget Target2, Sema::CUDAFunctionTarget *ResolvedTarget) { - if (Target1 == Sema::CFT_Global && Target2 == Sema::CFT_Global) { - // TODO: this shouldn't happen, really. Methods cannot be marked __global__. - // Clang should detect this earlier and produce an error. Then this - // condition can be changed to an assertion. - return true; - } + // Only free functions and static member functions may be global. + assert(Target1 != Sema::CFT_Global); + assert(Target2 != Sema::CFT_Global); if (Target1 == Sema::CFT_HostDevice) { *ResolvedTarget = Target2; |