1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX 2 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS 3 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX32 4 // RUN: %clang_cc1 -triple armv7--linux-gnueabihf -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=ARM 5 6 // enum CallingConv { 7 // CC_C, // __attribute__((cdecl)) 8 // CC_X86StdCall, // __attribute__((stdcall)) 9 // CC_X86FastCall, // __attribute__((fastcall)) 10 // CC_X86ThisCall, // __attribute__((thiscall)) 11 // CC_X86VectorCall, // __attribute__((vectorcall)) 12 // CC_X86Pascal, // __attribute__((pascal)) 13 // CC_Win64, // __attribute__((ms_abi)) 14 // CC_X86_64SysV, // __attribute__((sysv_abi)) 15 // CC_X86RegCall, // __attribute__((regcall)) 16 // CC_AAPCS, // __attribute__((pcs("aapcs"))) 17 // CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp"))) 18 // CC_IntelOclBicc, // __attribute__((intel_ocl_bicc)) 19 // CC_SpirFunction, // default for OpenCL functions on SPIR target 20 // CC_OpenCLKernel, // inferred for OpenCL kernels 21 // CC_Swift, // __attribute__((swiftcall)) 22 // CC_SwiftAsync, // __attribute__((swiftasynccall)) 23 // CC_PreserveMost, // __attribute__((preserve_most)) 24 // CC_PreserveAll, // __attribute__((preserve_all)) 25 // }; 26 27 #ifdef __x86_64__ 28 29 #ifdef __linux__ 30 // LINUX: !DISubprogram({{.*}}"add_msabi", {{.*}}type: ![[FTY:[0-9]+]] 31 // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Win64, 32 __attribute__((ms_abi)) int add_msabi(int a, int b) { 33 return a+b; 34 } 35 36 // LINUX: !DISubprogram({{.*}}"add_regcall", {{.*}}type: ![[FTY:[0-9]+]] 37 // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86RegCall, 38 __attribute__((regcall)) int add_regcall(int a, int b) { 39 return a+b; 40 } 41 42 // LINUX: !DISubprogram({{.*}}"add_preserve_most", {{.*}}type: ![[FTY:[0-9]+]] 43 // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveMost, 44 __attribute__((preserve_most)) int add_preserve_most(int a, int b) { 45 return a+b; 46 } 47 48 // LINUX: !DISubprogram({{.*}}"add_preserve_all", {{.*}}type: ![[FTY:[0-9]+]] 49 // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveAll, 50 __attribute__((preserve_all)) int add_preserve_all(int a, int b) { 51 return a+b; 52 } 53 54 // LINUX: !DISubprogram({{.*}}"add_swiftcall", {{.*}}type: ![[FTY:[0-9]+]] 55 // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift, 56 __attribute__((swiftcall)) int add_swiftcall(int a, int b) { 57 return a+b; 58 } 59 60 // [FIXME: swiftasynccc] Update debuginfo tag to SwiftAsync once LLVM support lands. 61 // LINUX: !DISubprogram({{.*}}"add_swiftasynccall", {{.*}}type: ![[FTY:[0-9]+]] 62 // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift, 63 __attribute__((swiftasynccall)) int add_swiftasynccall(int a, int b, int c) { 64 return a+b+c; 65 } 66 67 // LINUX: !DISubprogram({{.*}}"add_inteloclbicc", {{.*}}type: ![[FTY:[0-9]+]] 68 // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_IntelOclBicc, 69 __attribute__((intel_ocl_bicc)) int add_inteloclbicc(int a, int b) { 70 return a+b; 71 } 72 #endif 73 74 #ifdef _WIN64 75 // WINDOWS: !DISubprogram({{.*}}"add_sysvabi", {{.*}}type: ![[FTY:[0-9]+]] 76 // WINDOWS: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86_64SysV, 77 __attribute__((sysv_abi)) int add_sysvabi(int a, int b) { 78 return a+b; 79 } 80 #endif 81 82 #endif 83 84 #ifdef __i386__ 85 // LINUX32: !DISubprogram({{.*}}"add_stdcall", {{.*}}type: ![[FTY:[0-9]+]] 86 // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_stdcall, 87 __attribute__((stdcall)) int add_stdcall(int a, int b) { 88 return a+b; 89 } 90 91 // LINUX32: !DISubprogram({{.*}}"add_fastcall", {{.*}}type: ![[FTY:[0-9]+]] 92 // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_msfastcall, 93 __attribute__((fastcall)) int add_fastcall(int a, int b) { 94 return a+b; 95 } 96 97 // LINUX32: !DISubprogram({{.*}}"add_thiscall", {{.*}}type: ![[FTY:[0-9]+]] 98 // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_thiscall, 99 __attribute__((thiscall)) int add_thiscall(int a, int b) { 100 return a+b; 101 } 102 103 // LINUX32: !DISubprogram({{.*}}"add_vectorcall", {{.*}}type: ![[FTY:[0-9]+]] 104 // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_vectorcall, 105 __attribute__((vectorcall)) int add_vectorcall(int a, int b) { 106 return a+b; 107 } 108 109 // LINUX32: !DISubprogram({{.*}}"add_pascal", {{.*}}type: ![[FTY:[0-9]+]] 110 // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_pascal, 111 __attribute__((pascal)) int add_pascal(int a, int b) { 112 return a+b; 113 } 114 #endif 115 116 #ifdef __arm__ 117 // ARM: !DISubprogram({{.*}}"add_aapcs", {{.*}}type: ![[FTY:[0-9]+]] 118 // ARM: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS, 119 __attribute__((pcs("aapcs"))) int add_aapcs(int a, int b) { 120 return a+b; 121 } 122 123 // ARM: !DISubprogram({{.*}}"add_aapcs_vfp", {{.*}}type: ![[FTY:[0-9]+]] 124 // ARM: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS_VFP, 125 __attribute__((pcs("aapcs-vfp"))) int add_aapcs_vfp(int a, int b) { 126 return a+b; 127 } 128 #endif 129