[clang] [clang][SPIR-V] Use the C calling convention as the target default (PR #210882)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 09:02:33 PDT 2026


================
@@ -1793,9 +1793,13 @@ llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
                                 Flags, Annotations);
 }
 
-static unsigned getDwarfCC(CallingConv CC) {
+static unsigned getDwarfCC(CallingConv CC, const llvm::Triple &T) {
   switch (CC) {
   case CC_C:
+    // On SPIR/SPIR-V, CC_C is the target default calling convention and lowers
+    // to spir_func, so describe it that way.
+    if (T.isSPIROrSPIRV())
+      return llvm::dwarf::DW_CC_LLVM_SpirFunction;
----------------
schittir wrote:

A note: I don't see a test checking clang's emission of DW_CC_LLVM_SpirFunction, but perhaps it is not this PR's responsibility to add coverage for it. @tahonermann 

https://github.com/llvm/llvm-project/pull/210882


More information about the cfe-commits mailing list