r235350 - DebugInfo: Prepare for deletion of subclasses of DIType

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Apr 20 14:17:26 PDT 2015


Author: dexonsmith
Date: Mon Apr 20 16:17:26 2015
New Revision: 235350

URL: http://llvm.org/viewvc/llvm-project?rev=235350&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=235350&r1=235349&r2=235350&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Apr 20 16:17:26 2015
@@ -901,9 +901,9 @@ void CGDebugInfo::CollectRecordLambdaFie
 }
 
 /// 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::CreateR
   }
 
   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::CollectRecordNormalFie
 void CGDebugInfo::CollectRecordFields(
     const RecordDecl *record, llvm::DIFile tunit,
     SmallVectorImpl<llvm::Metadata *> &elements,
-    llvm::DICompositeType RecordTy) {
+    llvm::MDCompositeType *RecordTy) {
   const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(record);
 
   if (CXXDecl && CXXDecl->isLambda())
@@ -2460,10 +2460,8 @@ llvm::DISubprogram CGDebugInfo::getFunct
   if (MI == SPCache.end()) {
     if (const CXXMethodDecl *MD =
             dyn_cast<CXXMethodDecl>(FD->getCanonicalDecl())) {
-      llvm::DICompositeType T = cast<llvm::MDCompositeType>(S);
-      llvm::DISubprogram SP =
-          CreateCXXMemberFunction(MD, getOrCreateFile(MD->getLocation()), T);
-      return SP;
+      return CreateCXXMemberFunction(MD, getOrCreateFile(MD->getLocation()),
+                                     cast<llvm::MDCompositeType>(S));
     }
   }
   if (MI != SPCache.end()) {
@@ -3141,21 +3139,21 @@ void CGDebugInfo::EmitDeclareOfBlockLite
 
 /// 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<llvm::MDDerivedTypeBase>(MI->second);
+    return cast<llvm::MDDerivedType>(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<llvm::MDCompositeType>(getContextDescriptor(cast<Decl>(DC)));
   return CreateRecordStaticField(D, Ctxt, cast<RecordDecl>(DC));
 }
@@ -3181,9 +3179,9 @@ llvm::DIGlobalVariable CGDebugInfo::Coll
       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;
 }

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=235350&r1=235349&r2=235350&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Mon Apr 20 16:17:26 2015
@@ -197,16 +197,16 @@ class CGDebugInfo {
   void CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl,
                                  SmallVectorImpl<llvm::Metadata *> &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<llvm::Metadata *> &E,
                                 llvm::MDType *RecordTy, const RecordDecl *RD);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile F,
                            SmallVectorImpl<llvm::Metadata *> &E,
-                           llvm::DICompositeType RecordTy);
+                           llvm::MDCompositeType *RecordTy);
 
   void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile F,
                          SmallVectorImpl<llvm::Metadata *> &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





More information about the cfe-commits mailing list