diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 6d2123a7b0e17..675df309e3f0f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -810,10 +810,6 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) { return DBuilder.createBasicType(BTName, Size, Encoding); } -llvm::DIType *CGDebugInfo::CreateType(const AutoType *Ty) { - return DBuilder.createUnspecifiedType("auto"); -} - llvm::DIType *CGDebugInfo::CreateType(const ComplexType *Ty) { // Bit size and offset of the type. llvm::dwarf::TypeKind Encoding = llvm::dwarf::DW_ATE_complex_float; @@ -1461,18 +1457,16 @@ void CGDebugInfo::CollectRecordFields( llvm::DISubroutineType * CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method, - llvm::DIFile *Unit, bool decl) { + llvm::DIFile *Unit) { const FunctionProtoType *Func = Method->getType()->getAs(); if (Method->isStatic()) return cast_or_null( getOrCreateType(QualType(Func, 0), Unit)); - return getOrCreateInstanceMethodType(Method->getThisType(), Func, Unit, decl); + return getOrCreateInstanceMethodType(Method->getThisType(), Func, Unit); } -llvm::DISubroutineType * -CGDebugInfo::getOrCreateInstanceMethodType(QualType ThisPtr, - const FunctionProtoType *Func, - llvm::DIFile *Unit, bool decl) { +llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( + QualType ThisPtr, const FunctionProtoType *Func, llvm::DIFile *Unit) { // Add "this" pointer. llvm::DITypeRefArray Args( cast(getOrCreateType(QualType(Func, 0), Unit)) @@ -1480,12 +1474,9 @@ CGDebugInfo::getOrCreateInstanceMethodType(QualType ThisPtr, assert(Args.size() && "Invalid number of arguments!"); SmallVector Elts; + // First element is always return type. For 'void' functions it is NULL. - QualType temp = Func->getReturnType(); - if (temp->getTypeClass() == Type::Auto && decl) - Elts.push_back(CreateType(cast(temp))); - else - Elts.push_back(Args[0]); + Elts.push_back(Args[0]); // "this" pointer is always first argument. const CXXRecordDecl *RD = ThisPtr->getPointeeCXXRecordDecl(); @@ -1544,7 +1535,7 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction( isa(Method) || isa(Method); StringRef MethodName = getFunctionName(Method); - llvm::DISubroutineType *MethodTy = getOrCreateMethodType(Method, Unit, true); + llvm::DISubroutineType *MethodTy = getOrCreateMethodType(Method, Unit); // Since a single ctor/dtor corresponds to multiple functions, it doesn't // make sense to give a single ctor/dtor a linkage name. @@ -2763,7 +2754,7 @@ llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty, return DBuilder.createMemberPointerType( getOrCreateInstanceMethodType( CXXMethodDecl::getThisType(FPT, Ty->getMostRecentCXXRecordDecl()), - FPT, U, false), + FPT, U), ClassType, Size, /*Align=*/0, Flags); } @@ -3538,7 +3529,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D, return DBuilder.createSubroutineType(DBuilder.getOrCreateTypeArray(None)); if (const auto *Method = dyn_cast(D)) - return getOrCreateMethodType(Method, F, false); + return getOrCreateMethodType(Method, F); const auto *FTy = FnType->getAs(); CallingConv CC = FTy ? FTy->getCallConv() : CallingConv::CC_C; diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index d9c6b4d790976..90e9a61ebe96d 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -165,7 +165,6 @@ class CGDebugInfo { /// ivars and property accessors. llvm::DIType *CreateType(const BuiltinType *Ty); llvm::DIType *CreateType(const ComplexType *Ty); - llvm::DIType *CreateType(const AutoType *Ty); llvm::DIType *CreateQualifiedType(QualType Ty, llvm::DIFile *Fg); llvm::DIType *CreateType(const TypedefType *Ty, llvm::DIFile *Fg); llvm::DIType *CreateType(const TemplateSpecializationType *Ty, @@ -215,10 +214,10 @@ class CGDebugInfo { /// not updated to include implicit \c this pointer. Use this routine /// to get a method type which includes \c this pointer. llvm::DISubroutineType *getOrCreateMethodType(const CXXMethodDecl *Method, - llvm::DIFile *F, bool decl); + llvm::DIFile *F); llvm::DISubroutineType * getOrCreateInstanceMethodType(QualType ThisPtr, const FunctionProtoType *Func, - llvm::DIFile *Unit, bool decl); + llvm::DIFile *Unit); llvm::DISubroutineType * getOrCreateFunctionType(const Decl *D, QualType FnType, llvm::DIFile *F); /// \return debug info descriptor for vtable. diff --git a/clang/test/CodeGenCXX/debug-info-auto-return.cpp b/clang/test/CodeGenCXX/debug-info-auto-return.cpp deleted file mode 100644 index 8b4c5cb3ad9b3..0000000000000 --- a/clang/test/CodeGenCXX/debug-info-auto-return.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Test for debug info for C++11 auto return member functions -// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple x86_64-linux-gnu %s -o - \ -// RUN: -O0 -disable-llvm-passes \ -// RUN: -debug-info-kind=standalone \ -// RUN: | FileCheck %s - -// CHECK: !DISubprogram(name: "findMax",{{.*}}, type: ![[FUN_TYPE:[0-9]+]],{{.*}} - -// CHECK: ![[FUN_TYPE]] = !DISubroutineType(types: ![[TYPE_NODE:[0-9]+]]) -// CHECK-NEXT: ![[TYPE_NODE]] = !{![[DOUBLE_TYPE:[0-9]+]], {{.*}} -// CHECK-NEXT: ![[DOUBLE_TYPE]] = !DIBasicType(name: "double", {{.*}}) - -// CHECK: !DISubroutineType(types: ![[TYPE_DECL_NODE:[0-9]+]]) -// CHECK-NEXT: ![[TYPE_DECL_NODE]] = !{![[AUTO_TYPE:[0-9]+]], {{.*}} -// CHECK-NEXT: ![[AUTO_TYPE]] = !DIBasicType(tag: DW_TAG_unspecified_type, name: "auto") -struct myClass { - auto findMax(); -}; - -auto myClass::findMax() { - return 0.0; -}