@@ -2003,8 +2003,17 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
2003
2003
return getOrCreateInstanceMethodType (ThisType, Func, Unit);
2004
2004
}
2005
2005
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) {
2008
2017
FunctionProtoType::ExtProtoInfo EPI = Func->getExtProtoInfo ();
2009
2018
Qualifiers &Qc = EPI.TypeQuals ;
2010
2019
Qc.removeConst ();
@@ -2044,7 +2053,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
2044
2053
}
2045
2054
2046
2055
// 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)
2048
2057
Elts.push_back (Args[i]);
2049
2058
2050
2059
// Attach FlagObjectPointer to the explicit "this" parameter.
@@ -4352,6 +4361,10 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
4352
4361
// subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields.
4353
4362
return DBuilder.createSubroutineType (DBuilder.getOrCreateTypeArray ({}));
4354
4363
4364
+ if (const auto *Method = dyn_cast<CXXDestructorDecl>(D)) {
4365
+ return getOrCreateMethodTypeForDestructor (Method, F, FnType);
4366
+ }
4367
+
4355
4368
if (const auto *Method = dyn_cast<CXXMethodDecl>(D))
4356
4369
return getOrCreateMethodType (Method, F);
4357
4370
0 commit comments