137 lines · c
1// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX2// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS3// RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS4// RUN: %clang_cc1 -triple x86_64-unknown-windows-cygnus -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS5// RUN: %clang_cc1 -triple i386-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX326// RUN: %clang_cc1 -triple armv7--linux-gnueabihf -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=ARM7 8// enum CallingConv {9// CC_C, // __attribute__((cdecl))10// CC_X86StdCall, // __attribute__((stdcall))11// CC_X86FastCall, // __attribute__((fastcall))12// CC_X86ThisCall, // __attribute__((thiscall))13// CC_X86VectorCall, // __attribute__((vectorcall))14// CC_X86Pascal, // __attribute__((pascal))15// CC_Win64, // __attribute__((ms_abi))16// CC_X86_64SysV, // __attribute__((sysv_abi))17// CC_X86RegCall, // __attribute__((regcall))18// CC_AAPCS, // __attribute__((pcs("aapcs")))19// CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp")))20// CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))21// CC_SpirFunction, // default for OpenCL functions on SPIR target22// CC_OpenCLKernel, // inferred for OpenCL kernels23// CC_Swift, // __attribute__((swiftcall))24// CC_SwiftAsync, // __attribute__((swiftasynccall))25// CC_PreserveMost, // __attribute__((preserve_most))26// CC_PreserveAll, // __attribute__((preserve_all))27// CC_PreserveNone, // __attribute__((preserve_none))28// };29 30#ifdef __x86_64__31 32#ifdef __linux__33// LINUX: !DISubprogram({{.*}}"add_msabi", {{.*}}type: ![[FTY:[0-9]+]]34// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Win64,35__attribute__((ms_abi)) int add_msabi(int a, int b) {36 return a+b;37}38 39// LINUX: !DISubprogram({{.*}}"add_regcall", {{.*}}type: ![[FTY:[0-9]+]]40// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86RegCall,41__attribute__((regcall)) int add_regcall(int a, int b) {42 return a+b;43}44 45// LINUX: !DISubprogram({{.*}}"add_preserve_most", {{.*}}type: ![[FTY:[0-9]+]]46// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveMost,47__attribute__((preserve_most)) int add_preserve_most(int a, int b) {48 return a+b;49}50 51// LINUX: !DISubprogram({{.*}}"add_preserve_all", {{.*}}type: ![[FTY:[0-9]+]]52// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveAll,53__attribute__((preserve_all)) int add_preserve_all(int a, int b) {54 return a+b;55}56 57// LINUX: !DISubprogram({{.*}}"add_preserve_none", {{.*}}type: ![[FTY:[0-9]+]]58// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveNone,59__attribute__((preserve_none)) int add_preserve_none(int a, int b) {60 return a+b;61}62 63// LINUX: !DISubprogram({{.*}}"add_swiftcall", {{.*}}type: ![[FTY:[0-9]+]]64// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift,65__attribute__((swiftcall)) int add_swiftcall(int a, int b) {66 return a+b;67}68 69// LINUX: !DISubprogram({{.*}}"add_swiftasynccall", {{.*}}type: ![[FTY:[0-9]+]]70// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_SwiftTail,71__attribute__((swiftasynccall)) int add_swiftasynccall(int a, int b) {72 return a+b;73}74 75// LINUX: !DISubprogram({{.*}}"add_inteloclbicc", {{.*}}type: ![[FTY:[0-9]+]]76// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_IntelOclBicc,77__attribute__((intel_ocl_bicc)) int add_inteloclbicc(int a, int b) {78 return a+b;79}80#endif81 82#if defined(_WIN64) || defined(__CYGWIN__)83// WINDOWS: !DISubprogram({{.*}}"add_sysvabi", {{.*}}type: ![[FTY:[0-9]+]]84// WINDOWS: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86_64SysV,85__attribute__((sysv_abi)) int add_sysvabi(int a, int b) {86 return a+b;87}88#endif89 90#endif91 92#ifdef __i386__93// LINUX32: !DISubprogram({{.*}}"add_stdcall", {{.*}}type: ![[FTY:[0-9]+]]94// LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_stdcall,95__attribute__((stdcall)) int add_stdcall(int a, int b) {96 return a+b;97}98 99// LINUX32: !DISubprogram({{.*}}"add_fastcall", {{.*}}type: ![[FTY:[0-9]+]]100// LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_msfastcall,101__attribute__((fastcall)) int add_fastcall(int a, int b) {102 return a+b;103}104 105// LINUX32: !DISubprogram({{.*}}"add_thiscall", {{.*}}type: ![[FTY:[0-9]+]]106// LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_thiscall,107__attribute__((thiscall)) int add_thiscall(int a, int b) {108 return a+b;109}110 111// LINUX32: !DISubprogram({{.*}}"add_vectorcall", {{.*}}type: ![[FTY:[0-9]+]]112// LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_vectorcall,113__attribute__((vectorcall)) int add_vectorcall(int a, int b) {114 return a+b;115}116 117// LINUX32: !DISubprogram({{.*}}"add_pascal", {{.*}}type: ![[FTY:[0-9]+]]118// LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_pascal,119__attribute__((pascal)) int add_pascal(int a, int b) {120 return a+b;121}122#endif123 124#ifdef __arm__125// ARM: !DISubprogram({{.*}}"add_aapcs", {{.*}}type: ![[FTY:[0-9]+]]126// ARM: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS,127__attribute__((pcs("aapcs"))) int add_aapcs(int a, int b) {128 return a+b;129}130 131// ARM: !DISubprogram({{.*}}"add_aapcs_vfp", {{.*}}type: ![[FTY:[0-9]+]]132// ARM: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS_VFP,133__attribute__((pcs("aapcs-vfp"))) int add_aapcs_vfp(int a, int b) {134 return a+b;135}136#endif137