llvm-dwarfdump: Including calling convention attribute in pretty printed type names

This commit is contained in:
David Blaikie 2022-03-21 19:37:39 +00:00
parent a3095a25d0
commit 4841dab4af
3 changed files with 2279 additions and 2112 deletions

View File

@ -323,6 +323,8 @@ int main() {
f1<const unsigned _BitInt(5)>();
f1<void(t1<>, t1<>)>();
f1<int t1<>::*>();
void fcc() __attribute__((swiftcall));
f1<decltype(fcc)>();
}
void t8::mem() {
struct t7 { };

View File

@ -652,6 +652,64 @@ struct DWARFTypePrinter {
}
}
}
if (auto CC = D.find(DW_AT_calling_convention)) {
switch (*CC->getAsUnsignedConstant()) {
case CallingConvention::DW_CC_BORLAND_stdcall:
OS << " __attribute__((stdcall))";
break;
case CallingConvention::DW_CC_BORLAND_msfastcall:
OS << " __attribute__((fastcall))";
break;
case CallingConvention::DW_CC_BORLAND_thiscall:
OS << " __attribute__((thiscall))";
break;
case CallingConvention::DW_CC_LLVM_vectorcall:
OS << " __attribute__((vectorcall))";
break;
case CallingConvention::DW_CC_BORLAND_pascal:
OS << " __attribute__((pascal))";
break;
case CallingConvention::DW_CC_LLVM_Win64:
OS << " __attribute__((ms_abi))";
break;
case CallingConvention::DW_CC_LLVM_X86_64SysV:
OS << " __attribute__((sysv_abi))";
break;
case CallingConvention::DW_CC_LLVM_AAPCS:
// AArch64VectorCall missing?
OS << " __attribute__((pcs(\"aapcs\")))";
break;
case CallingConvention::DW_CC_LLVM_AAPCS_VFP:
OS << " __attribute__((pcs(\"aapcs-vfp\")))";
break;
case CallingConvention::DW_CC_LLVM_IntelOclBicc:
OS << " __attribute__((intel_ocl_bicc))";
break;
case CallingConvention::DW_CC_LLVM_SpirFunction:
case CallingConvention::DW_CC_LLVM_OpenCLKernel:
// These aren't available as attributes, but maybe we should still
// render them somehow? (Clang doesn't render them, but that's an issue
// for template names too - since then the DWARF names of templates
// instantiated with function types with these calling conventions won't
// have distinct names - so we'd need to fix that too)
break;
case CallingConvention::DW_CC_LLVM_Swift:
// SwiftAsync missing
OS << " __attribute__((swiftcall))";
break;
case CallingConvention::DW_CC_LLVM_PreserveMost:
OS << " __attribute__((preserve_most))";
break;
case CallingConvention::DW_CC_LLVM_PreserveAll:
OS << " __attribute__((preserve_all))";
break;
case CallingConvention::DW_CC_LLVM_X86RegCall:
OS << " __attribute__((regcall))";
break;
}
}
if (Const)
OS << " const";
if (Volatile)

File diff suppressed because it is too large Load Diff