From b2d139257d8e6d546622627b6d0b48ef7953230f Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 18 Jul 2013 00:52:50 +0000 Subject: [PATCH] Instead of checking against some version of "isType()" go ahead and use the conversion to bool to check if we've managed to get a type that isn't default constructed - as we meant to in the first place. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186556 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index ac6263666a..5e5caf370d 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -411,7 +411,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { case BuiltinType::Void: return llvm::DIType(); case BuiltinType::ObjCClass: - if (ClassTy.isType()) + if (ClassTy) return ClassTy; ClassTy = DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type, "objc_class", TheCU, @@ -423,10 +423,10 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { // Class isa; // } *id; - if (ObjTy.isCompositeType()) + if (ObjTy) return ObjTy; - if (!ClassTy.isType()) + if (!ClassTy) ClassTy = DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type, "objc_class", TheCU, getOrCreateMainFile(), 0); @@ -444,7 +444,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { return ObjTy; } case BuiltinType::ObjCSel: { - if (SelTy.isType()) + if (SelTy) return SelTy; SelTy = DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type, @@ -677,7 +677,7 @@ llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag, llvm::DIType CGDebugInfo::getOrCreateStructPtrType(StringRef Name, llvm::DIType &Cache) { - if (Cache.isType()) + if (Cache) return Cache; Cache = DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type, Name, TheCU, getOrCreateMainFile(), 0); @@ -688,7 +688,7 @@ llvm::DIType CGDebugInfo::getOrCreateStructPtrType(StringRef Name, llvm::DIType CGDebugInfo::CreateType(const BlockPointerType *Ty, llvm::DIFile Unit) { - if (BlockLiteralGeneric.isType()) + if (BlockLiteralGeneric) return BlockLiteralGeneric; SmallVector EltTys; @@ -754,7 +754,7 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty, llvm::DIFile Unit, // typedef, make sure to emit the whole chain. llvm::DIType Src = getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit, Declaration); - if (!Src.isType()) + if (!Src) return llvm::DIType(); // We don't set size information, but do specify where the typedef was // declared. @@ -1956,7 +1956,7 @@ void CGDebugInfo::completeFwdDecl(const RecordDecl &RD) { QualType QTy = CGM.getContext().getRecordType(&RD); llvm::DIType T = getTypeOrNull(QTy); - if (T.isType() && T.isForwardDecl()) + if (T && T.isForwardDecl()) getOrCreateType(QTy, getOrCreateFile(RD.getLocation())); } @@ -1988,7 +1988,7 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile Unit, llvm::DIType T = getCompletedTypeOrNull(Ty); - if (T.isType()) { + if (T) { // If we're looking for a definition, make sure we have definitions of any // underlying types. if (const TypedefType* TTy = dyn_cast(Ty)) @@ -2006,7 +2006,7 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile Unit, TypeCache[TyPtr] = Res; llvm::DIType TC = getTypeOrNull(Ty); - if (TC.isType() && TC.isForwardDecl()) + if (TC && TC.isForwardDecl()) ReplaceMap.push_back(std::make_pair(TyPtr, static_cast(TC))); else if (ObjCInterfaceDecl* Decl = getObjCInterfaceDecl(Ty)) { // Interface types may have elements added to them by a @@ -2166,12 +2166,12 @@ llvm::DIType CGDebugInfo::getOrCreateLimitedType(QualType Ty, // We may have cached a forward decl when we could have created // a non-forward decl. Go ahead and create a non-forward decl // now. - if (T.isType() && !T.isForwardDecl()) return T; + if (T && !T.isForwardDecl()) return T; // Otherwise create the type. llvm::DIType Res = CreateLimitedTypeNode(Ty, Unit); - if (T.isType() && T.isForwardDecl()) + if (T && T.isForwardDecl()) ReplaceMap.push_back(std::make_pair(Ty.getAsOpaquePtr(), static_cast(T))); @@ -2773,7 +2773,7 @@ void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD, llvm::DIType CGDebugInfo::CreateSelfType(const QualType &QualTy, llvm::DIType Ty) { llvm::DIType CachedTy = getTypeOrNull(QualTy); - if (CachedTy.isType()) Ty = CachedTy; + if (CachedTy) Ty = CachedTy; else DEBUG(llvm::dbgs() << "No cached type for self."); return DBuilder.createObjectPointerType(Ty); } @@ -3207,7 +3207,7 @@ void CGDebugInfo::finalize() { RepTy = llvm::DIType(cast(V)); } - if (Ty.isType() && Ty.isForwardDecl() && RepTy.isType()) + if (Ty && Ty.isForwardDecl() && RepTy) Ty.replaceAllUsesWith(RepTy); } -- 2.40.0