[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / builtin-longjmp.c
blob99463cf3385a1eb9a42b73778c72dfd5b5472175
1 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm < %s| FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s| FileCheck %s
3 // RUN: %clang_cc1 -triple x86_64-windows -emit-llvm < %s| FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm < %s| FileCheck %s
5 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm < %s| FileCheck %s
6 // RUN: %clang_cc1 -triple ve-unknown-unknown -emit-llvm < %s | FileCheck %s
8 // RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm-only -verify %s
9 // RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm-only -verify %s
10 // RUN: %clang_cc1 -triple mips64-unknown-unknown -emit-llvm-only -verify %s
11 // RUN: %clang_cc1 -triple sparc-eabi-unknown -emit-llvm-only -verify %s
13 // Check that __builtin_longjmp and __builtin_setjmp are lowered into
14 // IR intrinsics on those architectures that can handle them.
15 // Check that an error is created otherwise.
17 typedef void *jmp_buf;
18 jmp_buf buf;
20 // CHECK: define{{.*}} void @do_jump()
21 // CHECK: call{{.*}} void @llvm.eh.sjlj.longjmp
23 // CHECK: define{{.*}} void @do_setjmp()
24 // CHECK: call{{.*}} i32 @llvm.eh.sjlj.setjmp
26 void do_jump(void) {
27 __builtin_longjmp(buf, 1); // expected-error {{__builtin_longjmp is not supported for the current target}}
30 void f(void);
32 void do_setjmp(void) {
33 if (!__builtin_setjmp(buf)) // expected-error {{__builtin_setjmp is not supported for the current target}}
34 f();