From: Duncan P. N. Exon Smith Date: Mon, 20 Apr 2015 21:17:26 +0000 (+0000) Subject: DebugInfo: Prepare for deletion of subclasses of DIType X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5b4bb6556b6b055002bc91c127c1cc9f0c96181;p=clang DebugInfo: Prepare for deletion of subclasses of DIType Subclasses of (the already deleted) `DIType` will be deleted by an upcoming LLVM commit. Remove references. While `DICompositeType` wraps `MDCompositeTypeBase` and `DIDerivedType` wraps `MDDerivedTypeBase`, most uses of each really meant the more specific `MDCompositeType` and `MDDerivedType`. I updated accordingly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235350 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 2ff5dff9bb..e0b9f4aa17 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -901,9 +901,9 @@ void CGDebugInfo::CollectRecordLambdaFields( } /// Helper for CollectRecordFields. -llvm::DIDerivedType CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, - llvm::MDType *RecordTy, - const RecordDecl *RD) { +llvm::MDDerivedType * +CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::MDType *RecordTy, + const RecordDecl *RD) { // Create the descriptor for the static variable, with or without // constant initializers. Var = Var->getCanonicalDecl(); @@ -924,7 +924,7 @@ llvm::DIDerivedType CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, } unsigned Flags = getAccessFlag(Var->getAccess(), RD); - llvm::DIDerivedType GV = DBuilder.createStaticMemberType( + llvm::MDDerivedType *GV = DBuilder.createStaticMemberType( RecordTy, VName, VUnit, LineNumber, VTy, Flags, C); StaticDataMemberCache[Var->getCanonicalDecl()].reset(GV); return GV; @@ -960,7 +960,7 @@ void CGDebugInfo::CollectRecordNormalField( void CGDebugInfo::CollectRecordFields( const RecordDecl *record, llvm::DIFile tunit, SmallVectorImpl &elements, - llvm::DICompositeType RecordTy) { + llvm::MDCompositeType *RecordTy) { const CXXRecordDecl *CXXDecl = dyn_cast(record); if (CXXDecl && CXXDecl->isLambda()) @@ -2460,10 +2460,8 @@ llvm::DISubprogram CGDebugInfo::getFunctionDeclaration(const Decl *D) { if (MI == SPCache.end()) { if (const CXXMethodDecl *MD = dyn_cast(FD->getCanonicalDecl())) { - llvm::DICompositeType T = cast(S); - llvm::DISubprogram SP = - CreateCXXMemberFunction(MD, getOrCreateFile(MD->getLocation()), T); - return SP; + return CreateCXXMemberFunction(MD, getOrCreateFile(MD->getLocation()), + cast(S)); } } if (MI != SPCache.end()) { @@ -3141,21 +3139,21 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, /// If D is an out-of-class definition of a static data member of a class, find /// its corresponding in-class declaration. -llvm::DIDerivedType +llvm::MDDerivedType * CGDebugInfo::getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D) { if (!D->isStaticDataMember()) - return llvm::DIDerivedType(); + return nullptr; auto MI = StaticDataMemberCache.find(D->getCanonicalDecl()); if (MI != StaticDataMemberCache.end()) { assert(MI->second && "Static data member declaration should still exist"); - return cast(MI->second); + return cast(MI->second); } // If the member wasn't found in the cache, lazily construct and add it to the // type (used when a limited form of the type is emitted). auto DC = D->getDeclContext(); - llvm::DICompositeType Ctxt = + auto *Ctxt = cast(getContextDescriptor(cast(DC))); return CreateRecordStaticField(D, Ctxt, cast(DC)); } @@ -3181,9 +3179,9 @@ llvm::DIGlobalVariable CGDebugInfo::CollectAnonRecordDecls( continue; } // Use VarDecl's Tag, Scope and Line number. - GV = DBuilder.createGlobalVariable( - DContext, FieldName, LinkageName, Unit, LineNo, FieldTy, - Var->hasInternalLinkage(), Var, llvm::DIDerivedType()); + GV = DBuilder.createGlobalVariable(DContext, FieldName, LinkageName, Unit, + LineNo, FieldTy, + Var->hasInternalLinkage(), Var, nullptr); } return GV; } diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index 4c6ac1b0f2..2e38226ff5 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/lib/CodeGen/CGDebugInfo.h @@ -197,16 +197,16 @@ class CGDebugInfo { void CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl, SmallVectorImpl &E, llvm::MDType *RecordTy); - llvm::DIDerivedType CreateRecordStaticField(const VarDecl *Var, - llvm::MDType *RecordTy, - const RecordDecl *RD); + llvm::MDDerivedType *CreateRecordStaticField(const VarDecl *Var, + llvm::MDType *RecordTy, + const RecordDecl *RD); void CollectRecordNormalField(const FieldDecl *Field, uint64_t OffsetInBits, llvm::DIFile F, SmallVectorImpl &E, llvm::MDType *RecordTy, const RecordDecl *RD); void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile F, SmallVectorImpl &E, - llvm::DICompositeType RecordTy); + llvm::MDCompositeType *RecordTy); void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile F, SmallVectorImpl &EltTys); @@ -370,7 +370,7 @@ private: /// Return debug info descriptor to describe in-class static data member /// declaration for the given out-of-class definition. - llvm::DIDerivedType + llvm::MDDerivedType * getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D); /// \brief Create a DISubprogram describing the forward