Skip to content

Commit e45fcfc

Browse files
committed
Revert "[DWARF5][clang]: Added support for DebugInfo generation for auto return type for C++ member functions."
This reverts commit 6d6a459, which introduces a crash. See https://reviews.llvm.org/D70524 for details.
1 parent 734aa1d commit e45fcfc

File tree

3 files changed

+11
-43
lines changed

3 files changed

+11
-43
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,6 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
810810
return DBuilder.createBasicType(BTName, Size, Encoding);
811811
}
812812

813-
llvm::DIType *CGDebugInfo::CreateType(const AutoType *Ty) {
814-
return DBuilder.createUnspecifiedType("auto");
815-
}
816-
817813
llvm::DIType *CGDebugInfo::CreateType(const ComplexType *Ty) {
818814
// Bit size and offset of the type.
819815
llvm::dwarf::TypeKind Encoding = llvm::dwarf::DW_ATE_complex_float;
@@ -1461,31 +1457,26 @@ void CGDebugInfo::CollectRecordFields(
14611457

14621458
llvm::DISubroutineType *
14631459
CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
1464-
llvm::DIFile *Unit, bool decl) {
1460+
llvm::DIFile *Unit) {
14651461
const FunctionProtoType *Func = Method->getType()->getAs<FunctionProtoType>();
14661462
if (Method->isStatic())
14671463
return cast_or_null<llvm::DISubroutineType>(
14681464
getOrCreateType(QualType(Func, 0), Unit));
1469-
return getOrCreateInstanceMethodType(Method->getThisType(), Func, Unit, decl);
1465+
return getOrCreateInstanceMethodType(Method->getThisType(), Func, Unit);
14701466
}
14711467

1472-
llvm::DISubroutineType *
1473-
CGDebugInfo::getOrCreateInstanceMethodType(QualType ThisPtr,
1474-
const FunctionProtoType *Func,
1475-
llvm::DIFile *Unit, bool decl) {
1468+
llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
1469+
QualType ThisPtr, const FunctionProtoType *Func, llvm::DIFile *Unit) {
14761470
// Add "this" pointer.
14771471
llvm::DITypeRefArray Args(
14781472
cast<llvm::DISubroutineType>(getOrCreateType(QualType(Func, 0), Unit))
14791473
->getTypeArray());
14801474
assert(Args.size() && "Invalid number of arguments!");
14811475

14821476
SmallVector<llvm::Metadata *, 16> Elts;
1477+
14831478
// First element is always return type. For 'void' functions it is NULL.
1484-
QualType temp = Func->getReturnType();
1485-
if (temp->getTypeClass() == Type::Auto && decl)
1486-
Elts.push_back(CreateType(cast<AutoType>(temp)));
1487-
else
1488-
Elts.push_back(Args[0]);
1479+
Elts.push_back(Args[0]);
14891480

14901481
// "this" pointer is always first argument.
14911482
const CXXRecordDecl *RD = ThisPtr->getPointeeCXXRecordDecl();
@@ -1544,7 +1535,7 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
15441535
isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method);
15451536

15461537
StringRef MethodName = getFunctionName(Method);
1547-
llvm::DISubroutineType *MethodTy = getOrCreateMethodType(Method, Unit, true);
1538+
llvm::DISubroutineType *MethodTy = getOrCreateMethodType(Method, Unit);
15481539

15491540
// Since a single ctor/dtor corresponds to multiple functions, it doesn't
15501541
// make sense to give a single ctor/dtor a linkage name.
@@ -2763,7 +2754,7 @@ llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
27632754
return DBuilder.createMemberPointerType(
27642755
getOrCreateInstanceMethodType(
27652756
CXXMethodDecl::getThisType(FPT, Ty->getMostRecentCXXRecordDecl()),
2766-
FPT, U, false),
2757+
FPT, U),
27672758
ClassType, Size, /*Align=*/0, Flags);
27682759
}
27692760

@@ -3538,7 +3529,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
35383529
return DBuilder.createSubroutineType(DBuilder.getOrCreateTypeArray(None));
35393530

35403531
if (const auto *Method = dyn_cast<CXXMethodDecl>(D))
3541-
return getOrCreateMethodType(Method, F, false);
3532+
return getOrCreateMethodType(Method, F);
35423533

35433534
const auto *FTy = FnType->getAs<FunctionType>();
35443535
CallingConv CC = FTy ? FTy->getCallConv() : CallingConv::CC_C;

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ class CGDebugInfo {
165165
/// ivars and property accessors.
166166
llvm::DIType *CreateType(const BuiltinType *Ty);
167167
llvm::DIType *CreateType(const ComplexType *Ty);
168-
llvm::DIType *CreateType(const AutoType *Ty);
169168
llvm::DIType *CreateQualifiedType(QualType Ty, llvm::DIFile *Fg);
170169
llvm::DIType *CreateType(const TypedefType *Ty, llvm::DIFile *Fg);
171170
llvm::DIType *CreateType(const TemplateSpecializationType *Ty,
@@ -215,10 +214,10 @@ class CGDebugInfo {
215214
/// not updated to include implicit \c this pointer. Use this routine
216215
/// to get a method type which includes \c this pointer.
217216
llvm::DISubroutineType *getOrCreateMethodType(const CXXMethodDecl *Method,
218-
llvm::DIFile *F, bool decl);
217+
llvm::DIFile *F);
219218
llvm::DISubroutineType *
220219
getOrCreateInstanceMethodType(QualType ThisPtr, const FunctionProtoType *Func,
221-
llvm::DIFile *Unit, bool decl);
220+
llvm::DIFile *Unit);
222221
llvm::DISubroutineType *
223222
getOrCreateFunctionType(const Decl *D, QualType FnType, llvm::DIFile *F);
224223
/// \return debug info descriptor for vtable.

clang/test/CodeGenCXX/debug-info-auto-return.cpp

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)