[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / ms-setjmp.c
blobad4df790a611c1e351feff71c19663e8d3400e22
1 // RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=I386 %s
2 // RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=X64 %s
3 // RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple aarch64-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=AARCH64 %s
4 // RUN: %clang_cc1 -fms-extensions -triple i686-windows-msvc -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck --check-prefix=I386 %s
5 // RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck --check-prefix=X64 %s
6 // RUN: %clang_cc1 -fms-extensions -triple aarch64-windows-msvc -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck --check-prefix=AARCH64 %s
7 typedef char jmp_buf[1];
9 #ifdef DECLARE_SETJMP
10 int _setjmp(jmp_buf env);
11 int _setjmpex(jmp_buf env);
12 #endif
14 jmp_buf jb;
16 int test_setjmp(void) {
17 return _setjmp(jb);
18 // I386-LABEL: define dso_local i32 @test_setjmp
19 // I386: %[[call:.*]] = call i32 (ptr, i32, ...) @_setjmp3(ptr @jb, i32 0)
20 // I386-NEXT: ret i32 %[[call]]
22 // X64-LABEL: define dso_local i32 @test_setjmp
23 // X64: %[[addr:.*]] = call ptr @llvm.frameaddress.p0(i32 0)
24 // X64: %[[call:.*]] = call i32 @_setjmp(ptr @jb, ptr %[[addr]])
25 // X64-NEXT: ret i32 %[[call]]
27 // AARCH64-LABEL: define dso_local i32 @test_setjmp
28 // AARCH64: %[[addr:.*]] = call ptr @llvm.sponentry.p0()
29 // AARCH64: %[[call:.*]] = call i32 @_setjmpex(ptr @jb, ptr %[[addr]])
30 // AARCH64-NEXT: ret i32 %[[call]]
33 int test_setjmpex(void) {
34 return _setjmpex(jb);
35 // X64-LABEL: define dso_local i32 @test_setjmpex
36 // X64: %[[addr:.*]] = call ptr @llvm.frameaddress.p0(i32 0)
37 // X64: %[[call:.*]] = call i32 @_setjmpex(ptr @jb, ptr %[[addr]])
38 // X64-NEXT: ret i32 %[[call]]
40 // AARCH64-LABEL: define dso_local i32 @test_setjmpex
41 // AARCH64: %[[addr:.*]] = call ptr @llvm.sponentry.p0()
42 // AARCH64: %[[call:.*]] = call i32 @_setjmpex(ptr @jb, ptr %[[addr]])
43 // AARCH64-NEXT: ret i32 %[[call]]