Index: lib/CodeGen/CGDebugInfo.h =================================================================== --- lib/CodeGen/CGDebugInfo.h +++ lib/CodeGen/CGDebugInfo.h @@ -287,6 +287,9 @@ void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile *F, SmallVectorImpl &EltTys, llvm::DICompositeType *RecordTy); + + void CollectArgABIInfo(const CXXRecordDecl *Decl, + llvm::DICompositeType *RecordTy); /// @} /// Create a new lexical block node and push it on the stack. Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -944,6 +944,21 @@ return 0; } +static llvm::dwarf::CallingConvention getArgABI(const CodeGenModule &CGM, + const CXXRecordDecl *CXXDecl) { + switch (CGM.getCXXABI().getRecordArgABI(CXXDecl)) { + case CGCXXABI::RAA_Default: + return llvm::dwarf::DW_CC_pass_by_value; + case CGCXXABI::RAA_Indirect: + return llvm::dwarf::DW_CC_pass_by_reference; + case CGCXXABI::RAA_DirectInMemory: + // DWARFv5 doesn't specify explicit DW_CC_* value for this case, + // thus we just return 'normal' here. + return llvm::dwarf::DW_CC_normal; + } + return llvm::dwarf::DW_CC_normal; +} + llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty, llvm::DIFile *Unit) { SmallVector EltTys; @@ -1671,6 +1686,11 @@ EltTys.push_back(VPtrMember); } +void CGDebugInfo::CollectArgABIInfo(const CXXRecordDecl *Decl, + llvm::DICompositeType *RecordTy) { + DBuilder.replaceArgABI(RecordTy, getArgABI(CGM, Decl)); +} + llvm::DIType *CGDebugInfo::getOrCreateRecordType(QualType RTy, SourceLocation Loc) { assert(DebugKind >= codegenoptions::LimitedDebugInfo); @@ -1881,6 +1901,7 @@ if (CXXDecl) { CollectCXXBases(CXXDecl, DefUnit, EltTys, FwdDecl); CollectVTableInfo(CXXDecl, DefUnit, EltTys, FwdDecl); + CollectArgABIInfo(CXXDecl, FwdDecl); } // Collect data fields (including static variables and any initializers). Index: test/CodeGenCXX/debug-info-type-calling-conventions.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/debug-info-type-calling-conventions.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 %s -dwarf-version=5 -std=c++11 -debug-info-kind=limited -emit-llvm -o - | FileCheck %s + +struct DefaultDtor { + ~DefaultDtor() = default; +}; + +void f(DefaultDtor arg) {} + +// CHECK: !DICompositeType({{.*}}name: "DefaultDtor"{{.*}}argABI: DW_CC_pass_by_value + +class UserDtor { +public: + ~UserDtor() {} +}; + +void f(UserDtor arg) {} + +// CHECK: !DICompositeType({{.*}}name: "UserDtor"{{.*}}argABI: DW_CC_pass_by_reference