@@ -2003,8 +2003,17 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
20032003 return getOrCreateInstanceMethodType (ThisType, Func, Unit);
20042004}
20052005
2006- llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType (
2007- QualType ThisPtr, const FunctionProtoType *Func, llvm::DIFile *Unit) {
2006+ llvm::DISubroutineType *CGDebugInfo::getOrCreateMethodTypeForDestructor (
2007+ const CXXMethodDecl *Method, llvm::DIFile *Unit, QualType FNType) {
2008+ const FunctionProtoType *Func = FNType->getAs <FunctionProtoType>();
2009+ // skip the first param since it is also this
2010+ return getOrCreateInstanceMethodType (Method->getThisType (), Func, Unit, true );
2011+ }
2012+
2013+ llvm::DISubroutineType *
2014+ CGDebugInfo::getOrCreateInstanceMethodType (QualType ThisPtr,
2015+ const FunctionProtoType *Func,
2016+ llvm::DIFile *Unit, bool SkipFirst) {
20082017 FunctionProtoType::ExtProtoInfo EPI = Func->getExtProtoInfo ();
20092018 Qualifiers &Qc = EPI.TypeQuals ;
20102019 Qc.removeConst ();
@@ -2044,7 +2053,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
20442053 }
20452054
20462055 // Copy rest of the arguments.
2047- for (unsigned i = 1 , e = Args.size (); i != e; ++i)
2056+ for (unsigned i = (SkipFirst ? 2 : 1 ) , e = Args.size (); i != e; ++i)
20482057 Elts.push_back (Args[i]);
20492058
20502059 // Attach FlagObjectPointer to the explicit "this" parameter.
@@ -4352,6 +4361,10 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
43524361 // subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields.
43534362 return DBuilder.createSubroutineType (DBuilder.getOrCreateTypeArray ({}));
43544363
4364+ if (const auto *Method = dyn_cast<CXXDestructorDecl>(D)) {
4365+ return getOrCreateMethodTypeForDestructor (Method, F, FnType);
4366+ }
4367+
43554368 if (const auto *Method = dyn_cast<CXXMethodDecl>(D))
43564369 return getOrCreateMethodType (Method, F);
43574370
0 commit comments