mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-25 22:38:56 -04:00

Summary: These cause us to consider all functions in-between to be __host__ __device__. You can nest these pragmas; you just can't have more 'end's than 'begin's. Reviewers: rsmith Subscribers: tra, jhen, cfe-commits Differential Revision: https://reviews.llvm.org/D24975 llvm-svn: 283677
37 lines
891 B
Plaintext
37 lines
891 B
Plaintext
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
// Check the force_cuda_host_device pragma.
|
|
|
|
#pragma clang force_cuda_host_device begin
|
|
void f();
|
|
#pragma clang force_cuda_host_device begin
|
|
void g();
|
|
#pragma clang force_cuda_host_device end
|
|
void h();
|
|
#pragma clang force_cuda_host_device end
|
|
|
|
void i(); // expected-note {{not viable}}
|
|
|
|
void host() {
|
|
f();
|
|
g();
|
|
h();
|
|
i();
|
|
}
|
|
|
|
__attribute__((device)) void device() {
|
|
f();
|
|
g();
|
|
h();
|
|
i(); // expected-error {{no matching function}}
|
|
}
|
|
|
|
#pragma clang force_cuda_host_device foo
|
|
// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}}
|
|
|
|
#pragma clang force_cuda_host_device
|
|
// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}}
|
|
|
|
#pragma clang force_cuda_host_device begin foo
|
|
// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}}
|