From: Duncan P. N. Exon Smith Date: Tue, 21 Apr 2015 20:07:29 +0000 (+0000) Subject: DebugInfo: Prepare for removal of DIArray and DITypeArray typedefs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=431bf466edadebed39c04a9db63bcda013ff2a73;p=clang DebugInfo: Prepare for removal of DIArray and DITypeArray typedefs An upcoming LLVM commit will remove the `DIArray` and `DITypeArray` typedefs that shadow `DebugNodeArray` and `MDTypeRefArray`, respectively. Use those types directly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235412 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index d105d48ba7..d1920c1b13 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -423,7 +423,7 @@ llvm::MDType *CGDebugInfo::CreateType(const BuiltinType *BT) { ObjTy = DBuilder.createStructType(TheCU, "objc_object", getOrCreateMainFile(), - 0, 0, 0, 0, nullptr, llvm::DIArray()); + 0, 0, 0, 0, nullptr, llvm::DebugNodeArray()); DBuilder.replaceArrays( ObjTy, @@ -698,7 +698,7 @@ llvm::MDType *CGDebugInfo::CreateType(const BlockPointerType *Ty, QualType FType; uint64_t FieldSize, FieldOffset; unsigned FieldAlign; - llvm::DIArray Elements; + llvm::DebugNodeArray Elements; FieldOffset = 0; FType = CGM.getContext().UnsignedLongTy; @@ -801,7 +801,7 @@ llvm::MDType *CGDebugInfo::CreateType(const FunctionType *Ty, EltTys.push_back(DBuilder.createUnspecifiedParameter()); } - llvm::DITypeArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys); + llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys); return DBuilder.createSubroutineType(Unit, EltTypeArray); } @@ -1014,7 +1014,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method, llvm::MDSubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( QualType ThisPtr, const FunctionProtoType *Func, llvm::MDFile *Unit) { // Add "this" pointer. - llvm::DITypeArray Args( + llvm::MDTypeRefArray Args( cast(getOrCreateType(QualType(Func, 0), Unit)) ->getTypeArray()); assert(Args.size() && "Invalid number of arguments!"); @@ -1053,7 +1053,7 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( for (unsigned i = 1, e = Args.size(); i != e; ++i) Elts.push_back(Args[i]); - llvm::DITypeArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts); + llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts); unsigned Flags = 0; if (Func->getExtProtoInfo().RefQualifier == RQ_LValue) @@ -1139,7 +1139,8 @@ llvm::MDSubprogram *CGDebugInfo::CreateCXXMemberFunction( if (Method->getRefQualifier() == RQ_RValue) Flags |= llvm::DebugNode::FlagRValueReference; - llvm::DIArray TParamsArray = CollectFunctionTemplateParams(Method, Unit); + llvm::DebugNodeArray TParamsArray = + CollectFunctionTemplateParams(Method, Unit); llvm::MDSubprogram *SP = DBuilder.createMethod( RecordTy, MethodName, MethodLinkageName, MethodDefUnit, MethodLine, MethodTy, /*isLocalToUnit=*/false, @@ -1232,7 +1233,7 @@ void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::MDFile *Unit, } /// CollectTemplateParams - A helper function to collect template parameters. -llvm::DIArray +llvm::DebugNodeArray CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList, ArrayRef TAList, llvm::MDFile *Unit) { @@ -1338,8 +1339,9 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList, /// CollectFunctionTemplateParams - A helper function to collect debug /// info for function template parameters. -llvm::DIArray CGDebugInfo::CollectFunctionTemplateParams(const FunctionDecl *FD, - llvm::MDFile *Unit) { +llvm::DebugNodeArray +CGDebugInfo::CollectFunctionTemplateParams(const FunctionDecl *FD, + llvm::MDFile *Unit) { if (FD->getTemplatedKind() == FunctionDecl::TK_FunctionTemplateSpecialization) { const TemplateParameterList *TList = FD->getTemplateSpecializationInfo() @@ -1348,12 +1350,12 @@ llvm::DIArray CGDebugInfo::CollectFunctionTemplateParams(const FunctionDecl *FD, return CollectTemplateParams( TList, FD->getTemplateSpecializationArgs()->asArray(), Unit); } - return llvm::DIArray(); + return llvm::DebugNodeArray(); } /// CollectCXXTemplateParams - A helper function to collect debug info for /// template parameters. -llvm::DIArray CGDebugInfo::CollectCXXTemplateParams( +llvm::DebugNodeArray CGDebugInfo::CollectCXXTemplateParams( const ClassTemplateSpecializationDecl *TSpecial, llvm::MDFile *Unit) { // Always get the full list of parameters, not just the ones from // the specialization. @@ -1372,7 +1374,7 @@ llvm::MDType *CGDebugInfo::getOrCreateVTablePtrType(llvm::MDFile *Unit) { /* Function type */ llvm::Metadata *STy = getOrCreateType(Context.IntTy, Unit); - llvm::DITypeArray SElements = DBuilder.getOrCreateTypeArray(STy); + llvm::MDTypeRefArray SElements = DBuilder.getOrCreateTypeArray(STy); llvm::MDType *SubTy = DBuilder.createSubroutineType(Unit, SElements); unsigned Size = Context.getTypeSize(Context.VoidPtrTy); llvm::MDType *vtbl_ptr_type = @@ -1578,7 +1580,7 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) { LexicalBlockStack.pop_back(); RegionMap.erase(Ty->getDecl()); - llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys); + llvm::DebugNodeArray Elements = DBuilder.getOrCreateArray(EltTys); DBuilder.replaceArrays(FwdDecl, Elements); if (FwdDecl->isTemporary()) @@ -1662,9 +1664,9 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, if (ID->getImplementation()) Flags |= llvm::DebugNode::FlagObjcClassComplete; - llvm::MDCompositeType *RealDecl = - DBuilder.createStructType(Unit, ID->getName(), DefUnit, Line, Size, Align, - Flags, nullptr, llvm::DIArray(), RuntimeLang); + llvm::MDCompositeType *RealDecl = DBuilder.createStructType( + Unit, ID->getName(), DefUnit, Line, Size, Align, Flags, nullptr, + llvm::DebugNodeArray(), RuntimeLang); QualType QTy(Ty, 0); TypeCache[QTy.getAsOpaquePtr()].reset(RealDecl); @@ -1785,7 +1787,7 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, EltTys.push_back(FieldTy); } - llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys); + llvm::DebugNodeArray Elements = DBuilder.getOrCreateArray(EltTys); DBuilder.replaceArrays(RealDecl, Elements); LexicalBlockStack.pop_back(); @@ -1802,7 +1804,7 @@ llvm::MDType *CGDebugInfo::CreateType(const VectorType *Ty, Count = -1; llvm::Metadata *Subscript = DBuilder.getOrCreateSubrange(0, Count); - llvm::DIArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); + llvm::DebugNodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); uint64_t Size = CGM.getContext().getTypeSize(Ty); uint64_t Align = CGM.getContext().getTypeAlign(Ty); @@ -1856,7 +1858,7 @@ llvm::MDType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::MDFile *Unit) { EltTy = Ty->getElementType(); } - llvm::DIArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts); + llvm::DebugNodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts); return DBuilder.createArrayType(Size, Align, getOrCreateType(EltTy, Unit), SubscriptArray); @@ -1949,7 +1951,7 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { } // Return a CompositeType for the enum itself. - llvm::DIArray EltArray = DBuilder.getOrCreateArray(Enumerators); + llvm::DebugNodeArray EltArray = DBuilder.getOrCreateArray(Enumerators); llvm::MDFile *DefUnit = getOrCreateFile(ED->getLocation()); unsigned Line = getLineNumber(ED->getLocation()); @@ -2194,7 +2196,7 @@ llvm::MDType *CGDebugInfo::getOrCreateLimitedType(const RecordType *Ty, // Propagate members from the declaration to the definition // CreateType(const RecordType*) will overwrite this with the members in the // correct order if the full type is needed. - DBuilder.replaceArrays(Res, T ? T->getElements() : llvm::DIArray()); + DBuilder.replaceArrays(Res, T ? T->getElements() : llvm::DebugNodeArray()); // And update the type cache. TypeCache[QTy.getAsOpaquePtr()].reset(Res); @@ -2240,7 +2242,7 @@ llvm::MDCompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) { if (const ClassTemplateSpecializationDecl *TSpecial = dyn_cast(RD)) - DBuilder.replaceArrays(RealDecl, llvm::DIArray(), + DBuilder.replaceArrays(RealDecl, llvm::DebugNodeArray(), CollectCXXTemplateParams(TSpecial, DefUnit)); return RealDecl; } @@ -2281,9 +2283,12 @@ llvm::MDType *CGDebugInfo::CreateMemberType(llvm::MDFile *Unit, QualType FType, return Ty; } -void CGDebugInfo::collectFunctionDeclProps( - GlobalDecl GD, llvm::MDFile *Unit, StringRef &Name, StringRef &LinkageName, - llvm::MDScope *&FDContext, llvm::DIArray &TParamsArray, unsigned &Flags) { +void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::MDFile *Unit, + StringRef &Name, + StringRef &LinkageName, + llvm::MDScope *&FDContext, + llvm::DebugNodeArray &TParamsArray, + unsigned &Flags) { const FunctionDecl *FD = cast(GD.getDecl()); Name = getFunctionName(FD); // Use mangled name as linkage name for C/C++ functions. @@ -2359,7 +2364,7 @@ void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::MDFile *&Unit, llvm::MDSubprogram * CGDebugInfo::getFunctionForwardDeclaration(const FunctionDecl *FD) { - llvm::DIArray TParamsArray; + llvm::DebugNodeArray TParamsArray; StringRef Name, LinkageName; unsigned Flags = 0; SourceLocation Loc = FD->getLocation(); @@ -2508,7 +2513,7 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D, if (OMethod->isVariadic()) Elts.push_back(DBuilder.createUnspecifiedParameter()); - llvm::DITypeArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts); + llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts); return DBuilder.createSubroutineType(F, EltTypeArray); } @@ -2522,7 +2527,7 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D, for (unsigned i = 0, e = FPT->getNumParams(); i != e; ++i) EltTys.push_back(getOrCreateType(FPT->getParamType(i), F)); EltTys.push_back(DBuilder.createUnspecifiedParameter()); - llvm::DITypeArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys); + llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys); return DBuilder.createSubroutineType(F, EltTypeArray); } @@ -2545,7 +2550,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc, unsigned Flags = 0; llvm::MDFile *Unit = getOrCreateFile(Loc); llvm::MDScope *FDContext = Unit; - llvm::DIArray TParamsArray; + llvm::DebugNodeArray TParamsArray; if (!HasDecl) { // Use llvm function name. LinkageName = Fn->getName(); @@ -2746,7 +2751,7 @@ llvm::MDType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD, EltTys.push_back(FieldTy); FieldOffset += FieldSize; - llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys); + llvm::DebugNodeArray Elements = DBuilder.getOrCreateArray(EltTys); unsigned Flags = llvm::DebugNode::FlagBlockByrefStruct; @@ -3093,7 +3098,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, llvm::raw_svector_ostream(typeName) << "__block_literal_" << CGM.getUniqueBlockCount(); - llvm::DIArray fieldsArray = DBuilder.getOrCreateArray(fields); + llvm::DebugNodeArray fieldsArray = DBuilder.getOrCreateArray(fields); llvm::MDType *type = DBuilder.createStructType( tunit, typeName.str(), tunit, line, diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index 347927900b..19d8c7bdbb 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/lib/CodeGen/CGDebugInfo.h @@ -177,12 +177,12 @@ class CGDebugInfo { SmallVectorImpl &EltTys, llvm::MDType *RecordTy); - llvm::DIArray CollectTemplateParams(const TemplateParameterList *TPList, - ArrayRef TAList, - llvm::MDFile *Unit); - llvm::DIArray CollectFunctionTemplateParams(const FunctionDecl *FD, - llvm::MDFile *Unit); - llvm::DIArray + llvm::DebugNodeArray + CollectTemplateParams(const TemplateParameterList *TPList, + ArrayRef TAList, llvm::MDFile *Unit); + llvm::DebugNodeArray CollectFunctionTemplateParams(const FunctionDecl *FD, + llvm::MDFile *Unit); + llvm::DebugNodeArray CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TS, llvm::MDFile *F); @@ -421,7 +421,8 @@ private: void collectFunctionDeclProps(GlobalDecl GD, llvm::MDFile *Unit, StringRef &Name, StringRef &LinkageName, llvm::MDScope *&FDContext, - llvm::DIArray &TParamsArray, unsigned &Flags); + llvm::DebugNodeArray &TParamsArray, + unsigned &Flags); /// \brief Collect various properties of a VarDecl. void collectVarDeclProps(const VarDecl *VD, llvm::MDFile *&Unit,