]> granicus.if.org Git - clang/commitdiff
DI: Make getOrCreateLimitedType() return DICompositeType, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 24 Jul 2015 20:34:41 +0000 (20:34 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 24 Jul 2015 20:34:41 +0000 (20:34 +0000)
Change `getOrCreateLimitedType()` to return a `DICompositeType` and
remove the casts from its callers.  Inside, I've strengthened a `cast`
from `DICompositeTypeBase`, but the casts in the callers already prove
that this is safe.  There should be no functionality change here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243155 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h

index 9d115e3c0c7c02e4c8a2c97ca330575465b4a40b..d993b112f588271e857c025f9452e55f5d1bd636 100644 (file)
@@ -1509,9 +1509,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
   // its members.  Finally, we create a descriptor for the complete type (which
   // may refer to the forward decl if the struct is recursive) and replace all
   // uses of the forward declaration with the final definition.
-
-  auto *FwdDecl =
-      cast<llvm::DICompositeType>(getOrCreateLimitedType(Ty, DefUnit));
+  llvm::DICompositeType *FwdDecl = getOrCreateLimitedType(Ty, DefUnit);
 
   const RecordDecl *D = RD->getDefinition();
   if (!D || !D->isCompleteDefinition())
@@ -2175,11 +2173,11 @@ llvm::DIType *CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile *Unit) {
   llvm_unreachable("type should have been unwrapped!");
 }
 
-llvm::DIType *CGDebugInfo::getOrCreateLimitedType(const RecordType *Ty,
-                                                  llvm::DIFile *Unit) {
+llvm::DICompositeType *CGDebugInfo::getOrCreateLimitedType(const RecordType *Ty,
+                                                           llvm::DIFile *Unit) {
   QualType QTy(Ty, 0);
 
-  auto *T = cast_or_null<llvm::DICompositeTypeBase>(getTypeOrNull(QTy));
+  auto *T = cast_or_null<llvm::DICompositeType>(getTypeOrNull(QTy));
 
   // We may have cached a forward decl when we could have created
   // a non-forward decl. Go ahead and create a non-forward decl
index 73227bc118cc608796dd07aade1b26edd8160627..2925483543928cec3e7254c5185da07180dea57c 100644 (file)
@@ -390,7 +390,8 @@ private:
 
   /// Get the type from the cache or create a new partial type if
   /// necessary.
-  llvm::DIType *getOrCreateLimitedType(const RecordType *Ty, llvm::DIFile *F);
+  llvm::DICompositeType *getOrCreateLimitedType(const RecordType *Ty,
+                                                llvm::DIFile *F);
 
   /// Create type metadata for a source language type.
   llvm::DIType *CreateTypeNode(QualType Ty, llvm::DIFile *Fg);