From: Duncan P. N. Exon Smith Date: Fri, 24 Jul 2015 20:34:41 +0000 (+0000) Subject: DI: Make getOrCreateLimitedType() return DICompositeType, NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b3103c1323a5c4fa4c385f156a72fee1787e512;p=clang DI: Make getOrCreateLimitedType() return DICompositeType, NFC 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 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 9d115e3c0c..d993b112f5 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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(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(getTypeOrNull(QTy)); + auto *T = cast_or_null(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 diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index 73227bc118..2925483543 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/lib/CodeGen/CGDebugInfo.h @@ -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);