[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / cfstring-windows.c
blob7c17f31d3dd4a89d159a834ea10bfcd9b2fee62d
1 // RUN: %clang_cc1 -triple thumbv7-windows -fdeclspec -DCF_BUILDING_CF -DDECL -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-IN-CF-DECL
2 // RUN: %clang_cc1 -triple thumbv7-windows -fdeclspec -DCF_BUILDING_CF -DDEFN -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-IN-CF-DEFN
3 // RUN: %clang_cc1 -triple thumbv7-windows -fdeclspec -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF
4 // RUN: %clang_cc1 -triple thumbv7-windows -fdeclspec -DEXTERN -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-EXTERN
5 // RUN: %clang_cc1 -triple thumbv7-windows -fdeclspec -DEXTERN_DLLIMPORT -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-EXTERN-DLLIMPORT
6 // RUN: %clang_cc1 -triple thumbv7-windows -fdeclspec -DDLLIMPORT -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-DLLIMPORT
8 // RUN: %clang_cc1 -Os -triple thumbv7-windows -fdeclspec -DCF_BUILDING_CF -DDECL -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-IN-CF-DECL
9 // RUN: %clang_cc1 -Os -triple thumbv7-windows -fdeclspec -DCF_BUILDING_CF -DDEFN -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-IN-CF-DEFN
10 // RUN: %clang_cc1 -Os -triple thumbv7-windows -fdeclspec -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF
11 // RUN: %clang_cc1 -Os -triple thumbv7-windows -fdeclspec -DEXTERN -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-EXTERN
12 // RUN: %clang_cc1 -Os -triple thumbv7-windows -fdeclspec -DEXTERN_DLLIMPORT -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-EXTERN-DLLIMPORT
13 // RUN: %clang_cc1 -Os -triple thumbv7-windows -fdeclspec -DDLLIMPORT -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-CF-DLLIMPORT
15 #if defined(CF_BUILDING_CF)
16 #if defined(DECL)
17 extern __declspec(dllexport) long __CFConstantStringClassReference[];
18 #elif defined(DEFN)
19 __declspec(dllexport) long __CFConstantStringClassReference[32];
20 #endif
21 #else
22 #if defined(EXTERN)
23 extern long __CFConstantStringClassReference[];
24 #elif defined(EXTERN_DLLIMPORT)
25 extern __declspec(dllimport) long __CFConstantStringClassReference[];
26 #elif defined(DLLIMPORT)
27 __declspec(dllimport) long __CFConstantStringClassReference[];
28 #endif
29 #endif
31 typedef struct __CFString *CFStringRef;
32 const CFStringRef string = (CFStringRef)__builtin___CFStringMakeConstantString("string");
34 // CHECK-CF-IN-CF-DECL: @__CFConstantStringClassReference = external dso_local dllexport global [0 x i32]
35 // CHECK-CF-IN-CF-DEFN: @__CFConstantStringClassReference = dso_local dllexport global [32 x i32]
36 // CHECK-CF: @__CFConstantStringClassReference = external dllimport global [0 x i32]
37 // CHECK-CF-EXTERN: @__CFConstantStringClassReference = external dllimport global [0 x i32]
38 // CHECK-CF-EXTERN-DLLIMPORT: @__CFConstantStringClassReference = external dllimport global [0 x i32]
39 // CHECK-CF-DLLIMPORT: @__CFConstantStringClassReference = external dllimport global [0 x i32]