diff options
37 files changed, 155 insertions, 250 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index d1bf6929f6..5099c61819 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -431,11 +431,6 @@ public: const FunctionType *getAsFunctionType() const; const FunctionNoProtoType *getAsFunctionNoProtoType() const; const FunctionProtoType *getAsFunctionProtoType() const; - const LValueReferenceType *getAsLValueReferenceType() const; - const RValueReferenceType *getAsRValueReferenceType() const; - const MemberPointerType *getAsMemberPointerType() const; - const TagType *getAsTagType() const; - const RecordType *getAsRecordType() const; const RecordType *getAsStructureType() const; /// NOTE: getAs*ArrayType are methods on ASTContext. const TypedefType *getAsTypedefType() const; @@ -2152,7 +2147,7 @@ inline bool Type::isMemberPointerType() const { return isa<MemberPointerType>(CanonicalType.getUnqualifiedType()); } inline bool Type::isMemberFunctionPointerType() const { - if (const MemberPointerType* T = getAsMemberPointerType()) + if (const MemberPointerType* T = getAs<MemberPointerType>()) return T->getPointeeType()->isFunctionType(); else return false; diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index dcb18cb91d..f37ffddc12 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -2462,7 +2462,7 @@ QualType ASTContext::getCFConstantStringType() { } void ASTContext::setCFConstantStringType(QualType T) { - const RecordType *Rec = T->getAsRecordType(); + const RecordType *Rec = T->getAs<RecordType>(); assert(Rec && "Invalid CFConstantStringType"); CFConstantStringTypeDecl = Rec->getDecl(); } @@ -2498,7 +2498,7 @@ QualType ASTContext::getObjCFastEnumerationStateType() } void ASTContext::setObjCFastEnumerationStateType(QualType T) { - const RecordType *Rec = T->getAsRecordType(); + const RecordType *Rec = T->getAs<RecordType>(); assert(Rec && "Invalid ObjCFAstEnumerationStateType"); ObjCFastEnumerationStateTypeDecl = Rec->getDecl(); } @@ -2866,7 +2866,7 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S, return; } - if (const RecordType *RTy = T->getAsRecordType()) { + if (const RecordType *RTy = T->getAs<RecordType>()) { RecordDecl *RDecl = RTy->getDecl(); S += RDecl->isUnion() ? '(' : '{'; // Anonymous structures print as '?' diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 728724f1b3..a9f258146e 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -157,7 +157,7 @@ bool FieldDecl::isAnonymousStructOrUnion() const { if (!isImplicit() || getDeclName()) return false; - if (const RecordType *Record = getType()->getAsRecordType()) + if (const RecordType *Record = getType()->getAs<RecordType>()) return Record->getDecl()->isAnonymousStructOrUnion(); return false; @@ -704,24 +704,24 @@ SourceRange TagDecl::getSourceRange() const { } void TagDecl::startDefinition() { - TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType()); + TagType *TagT = const_cast<TagType *>(TypeForDecl->getAs<TagType>()); TagT->decl.setPointer(this); - TagT->getAsTagType()->decl.setInt(1); + TagT->getAs<TagType>()->decl.setInt(1); } void TagDecl::completeDefinition() { assert((!TypeForDecl || - TypeForDecl->getAsTagType()->decl.getPointer() == this) && + TypeForDecl->getAs<TagType>()->decl.getPointer() == this) && "Attempt to redefine a tag definition?"); IsDefinition = true; - TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType()); + TagType *TagT = const_cast<TagType *>(TypeForDecl->getAs<TagType>()); TagT->decl.setPointer(this); TagT->decl.setInt(0); } TagDecl* TagDecl::getDefinition(ASTContext& C) const { QualType T = C.getTypeDeclType(const_cast<TagDecl*>(this)); - TagDecl* D = cast<TagDecl>(T->getAsTagType()->getDecl()); + TagDecl* D = cast<TagDecl>(T->getAs<TagType>()->getDecl()); return D->isDefinition() ? D : 0; } diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 96ba19b9a6..2d276614f2 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -473,7 +473,7 @@ DeclContext *DeclContext::getPrimaryContext() { if (DeclKind >= Decl::TagFirst && DeclKind <= Decl::TagLast) { // If this is a tag type that has a definition or is currently // being defined, that definition is our primary context. - if (const TagType *TagT =cast<TagDecl>(this)->TypeForDecl->getAsTagType()) + if (const TagType *TagT =cast<TagDecl>(this)->TypeForDecl->getAs<TagType>()) if (TagT->isBeingDefined() || (TagT->getDecl() && TagT->getDecl()->isDefinition())) return TagT->getDecl(); diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 57ac611b2c..f420da14e4 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -81,7 +81,7 @@ CXXRecordDecl::setBases(ASTContext &C, if (BaseType->isDependentType()) continue; CXXRecordDecl *BaseClassDecl - = cast<CXXRecordDecl>(BaseType->getAsRecordType()->getDecl()); + = cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl()); if (Base->isVirtual()) hasDirectVirtualBase = true; for (CXXRecordDecl::base_class_iterator VBase = @@ -125,7 +125,7 @@ CXXRecordDecl::setBases(ASTContext &C, for (int i = 0; i < vbaseCount; i++) { QualType QT = UniqueVbases[i]->getType(); CXXRecordDecl *VBaseClassDecl - = cast<CXXRecordDecl>(QT->getAsRecordType()->getDecl()); + = cast<CXXRecordDecl>(QT->getAs<RecordType>()->getDecl()); this->VBases[i] = *new CXXBaseSpecifier( VBaseClassDecl->getSourceRange(), true, @@ -185,7 +185,7 @@ bool CXXRecordDecl::hasConstCopyAssignment(ASTContext &Context) const { continue; bool AcceptsConst = true; QualType ArgType = FnType->getArgType(0); - if (const LValueReferenceType *Ref = ArgType->getAsLValueReferenceType()) { + if (const LValueReferenceType *Ref = ArgType->getAs<LValueReferenceType>()) { ArgType = Ref->getPointeeType(); // Is it a non-const lvalue reference? if (!ArgType.isConstQualified()) @@ -237,7 +237,7 @@ void CXXRecordDecl::addedAssignmentOperator(ASTContext &Context, assert(FnType && "Overloaded operator has no proto function type."); assert(FnType->getNumArgs() == 1 && !FnType->isVariadic()); QualType ArgType = FnType->getArgType(0); - if (const LValueReferenceType *Ref = ArgType->getAsLValueReferenceType()) + if (const LValueReferenceType *Ref = ArgType->getAs<LValueReferenceType>()) ArgType = Ref->getPointeeType(); ArgType = ArgType.getUnqualifiedType(); @@ -433,7 +433,7 @@ CXXConstructorDecl::isCopyConstructor(ASTContext &Context, // Do we have a reference type? Rvalue references don't count. const LValueReferenceType *ParamRefType = - Param->getType()->getAsLValueReferenceType(); + Param->getType()->getAs<LValueReferenceType>(); if (!ParamRefType) return false; @@ -503,7 +503,7 @@ CXXDestructorDecl::setBaseOrMemberDestructions(ASTContext &C) { while (const ArrayType *AT = C.getAsArrayType(FieldType)) FieldType = AT->getElementType(); - if (FieldType->getAsRecordType()) { + if (FieldType->getAs<RecordType>()) { CXXBaseOrMemberInitializer *Member = new CXXBaseOrMemberInitializer((*Field), 0, 0, SourceLocation()); AllToDestruct.push_back(Member); @@ -535,12 +535,12 @@ CXXConstructorDecl::setBaseOrMemberInitializers( for (CXXRecordDecl::base_class_iterator VBase = ClassDecl->vbases_begin(), E = ClassDecl->vbases_end(); VBase != E; ++VBase) { - const Type * T = VBase->getType()->getAsRecordType(); + const Type * T = VBase->getType()->getAs<RecordType>(); unsigned int i = 0; for (i = 0; i < NumInitializers; i++) { CXXBaseOrMemberInitializer *Member = Initializers[i]; if (Member->isBaseInitializer() && - Member->getBaseClass()->getAsRecordType() == T) { + Member->getBaseClass()->getAs<RecordType>() == T) { AllToInit.push_back(Member); break; } @@ -557,12 +557,12 @@ CXXConstructorDecl::setBaseOrMemberInitializers( // Virtuals are in the virtual base list and already constructed. if (Base->isVirtual()) continue; - const Type * T = Base->getType()->getAsRecordType(); + const Type * T = Base->getType()->getAs<RecordType>(); unsigned int i = 0; for (i = 0; i < NumInitializers; i++) { CXXBaseOrMemberInitializer *Member = Initializers[i]; if (Member->isBaseInitializer() && - Member->getBaseClass()->getAsRecordType() == T) { + Member->getBaseClass()->getAs<RecordType>() == T) { AllToInit.push_back(Member); break; } @@ -589,7 +589,7 @@ CXXConstructorDecl::setBaseOrMemberInitializers( while (const ArrayType *AT = C.getAsArrayType(FieldType)) FieldType = AT->getElementType(); - if (FieldType->getAsRecordType()) { + if (FieldType->getAs<RecordType>()) { CXXBaseOrMemberInitializer *Member = new CXXBaseOrMemberInitializer((*Field), 0, 0, SourceLocation()); AllToInit.push_back(Member); diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 55d39e5cc8..1711a7cf56 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -353,7 +353,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { } else // FIXME. skip dependent types for now. if (const RecordType *RT = - BMInitializer->getBaseClass()->getAsRecordType()) { + BMInitializer->getBaseClass()->getAs<RecordType>()) { const CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(RT->getDecl()); Out << BaseDecl->getNameAsString(); @@ -394,7 +394,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { } else // FIXME. skip dependent types for now. if (const RecordType *RT = - BMInitializer->getBaseClass()->getAsRecordType()) { + BMInitializer->getBaseClass()->getAs<RecordType>()) { const CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(RT->getDecl()); Proto += "~"; diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp index a17abde777..a55b363a0d 100644 --- a/lib/AST/DeclarationName.cpp +++ b/lib/AST/DeclarationName.cpp @@ -135,7 +135,7 @@ std::string DeclarationName::getAsString() const { case CXXConstructorName: { QualType ClassType = getCXXNameType(); - if (const RecordType *ClassRec = ClassType->getAsRecordType()) + if (const RecordType *ClassRec = ClassType->getAs<RecordType>()) return ClassRec->getDecl()->getNameAsString(); return ClassType.getAsString(); } @@ -143,7 +143,7 @@ std::string DeclarationName::getAsString() const { case CXXDestructorName: { std::string Result = "~"; QualType Type = getCXXNameType(); - if (const RecordType *Rec = Type->getAsRecordType()) + if (const RecordType *Rec = Type->getAs<RecordType>()) Result += Rec->getDecl()->getNameAsString(); else Result += Type.getAsString(); @@ -170,7 +170,7 @@ std::string DeclarationName::getAsString() const { case CXXConversionFunctionName: { std::string Result = "operator "; QualType Type = getCXXNameType(); - if (const RecordType *Rec = Type->getAsRecordType()) + if (const RecordType *Rec = Type->getAs<RecordType>()) Result += Rec->getDecl()->getNameAsString(); else Result += Type.getAsString(); diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 74928bcd76..63a6d3153c 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -915,7 +915,7 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const { if (CT->isIncompleteType()) return MLV_IncompleteType; - if (const RecordType *r = CT->getAsRecordType()) { + if (const RecordType *r = CT->getAs<RecordType>()) { if (r->hasConstFields()) return MLV_ConstQualified; } diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 399c30255a..d5cfef23f8 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -219,28 +219,28 @@ bool UnaryTypeTraitExpr::EvaluateTrait() const { case UTT_IsPOD: return QueriedType->isPODType(); case UTT_IsClass: // Fallthrough case UTT_IsUnion: - if (const RecordType *Record = QueriedType->getAsRecordType()) { + if (const RecordType *Record = QueriedType->getAs<RecordType>()) { bool Union = Record->getDecl()->isUnion(); return UTT == UTT_IsUnion ? Union : !Union; } return false; case UTT_IsEnum: return QueriedType->isEnumeralType(); case UTT_IsPolymorphic: - if (const RecordType *Record = QueriedType->getAsRecordType()) { + if (const RecordType *Record = QueriedType->getAs<RecordType>()) { // Type traits are only parsed in C++, so we've got CXXRecords. return cast<CXXRecordDecl>(Record->getDecl())->isPolymorphic(); } return false; case UTT_IsAbstract: - if (const RecordType *RT = QueriedType->getAsRecordType()) + if (const RecordType *RT = QueriedType->getAs<RecordType>()) return cast<CXXRecordDecl>(RT->getDecl())->isAbstract(); return false; case UTT_HasTrivialConstructor: - if (const RecordType *RT = QueriedType->getAsRecordType()) + if (const RecordType *RT = QueriedType->getAs<RecordType>()) return cast<CXXRecordDecl>(RT->getDecl())->hasTrivialConstructor(); return false; case UTT_HasTrivialDestructor: - if (const RecordType *RT = QueriedType->getAsRecordType()) + if (const RecordType *RT = QueriedType->getAs<RecordType>()) return cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor(); return false; } diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 9473e4f48c..d01130372c 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -230,7 +230,7 @@ APValue LValueExprEvaluator::VisitMemberExpr(MemberExpr *E) { Ty = E->getBase()->getType(); } - RecordDecl *RD = Ty->getAsRecordType()->getDecl(); + RecordDecl *RD = Ty->getAs<RecordType>()->getDecl(); const ASTRecordLayout &RL = Info.Ctx.getASTRecordLayout(RD); FieldDecl *FD = dyn_cast<FieldDecl>(E->getMemberDecl()); diff --git a/lib/AST/InheritViz.cpp b/lib/AST/InheritViz.cpp index 1188ba5860..3e5dd1a53f 100644 --- a/lib/AST/InheritViz.cpp +++ b/lib/AST/InheritViz.cpp @@ -90,7 +90,7 @@ void InheritanceHierarchyWriter::WriteNode(QualType Type, bool FromVirtual) { // Display the base classes. const CXXRecordDecl *Decl - = static_cast<const CXXRecordDecl *>(Type->getAsRecordType()->getDecl()); + = static_cast<const CXXRecordDecl *>(Type->getAs<RecordType>()->getDecl()); for (CXXRecordDecl::base_class_const_iterator Base = Decl->bases_begin(); Base != Decl->bases_end(); ++Base) { QualType CanonBaseType = Context.getCanonicalType(Base->getType()); diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 28c3a8f42a..6114dba148 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -192,12 +192,12 @@ bool Type::isDerivedType() const { } bool Type::isClassType() const { - if (const RecordType *RT = getAsRecordType()) + if (const RecordType *RT = getAs<RecordType>()) return RT->getDecl()->isClass(); return false; } bool Type::isStructureType() const { - if (const RecordType *RT = getAsRecordType()) + if (const RecordType *RT = getAs<RecordType>()) return RT->getDecl()->isStruct(); return false; } @@ -208,7 +208,7 @@ bool Type::isVoidPointerType() const { } bool Type::isUnionType() const { - if (const RecordType *RT = getAsRecordType()) + if (const RecordType *RT = getAs<RecordType>()) return RT->getDecl()->isUnion(); return false; } @@ -305,60 +305,6 @@ QualType Type::getPointeeType() const { return QualType(); } -const LValueReferenceType *Type::getAsLValueReferenceType() const { - // If this is directly an lvalue reference type, return it. - if (const LValueReferenceType *RTy = dyn_cast<LValueReferenceType>(this)) - return RTy; - - // If the canonical form of this type isn't the right kind, reject it. - if (!isa<LValueReferenceType>(CanonicalType)) { - // Look through type qualifiers - if (isa<LValueReferenceType>(CanonicalType.getUnqualifiedType())) - return CanonicalType.getUnqualifiedType()->getAsLValueReferenceType(); - return 0; - } - - // If this is a typedef for an lvalue reference type, strip the typedef off - // without losing all typedef information. - return cast<LValueReferenceType>(getDesugaredType()); -} - -const RValueReferenceType *Type::getAsRValueReferenceType() const { - // If this is directly an rvalue reference type, return it. - if (const RValueReferenceType *RTy = dyn_cast<RValueReferenceType>(this)) - return RTy; - - // If the canonical form of this type isn't the right kind, reject it. - if (!isa<RValueReferenceType>(CanonicalType)) { - // Look through type qualifiers - if (isa<RValueReferenceType>(CanonicalType.getUnqualifiedType())) - return CanonicalType.getUnqualifiedType()->getAsRValueReferenceType(); - return 0; - } - - // If this is a typedef for an rvalue reference type, strip the typedef off - // without losing all typedef information. - return cast<RValueReferenceType>(getDesugaredType()); -} - -const MemberPointerType *Type::getAsMemberPointerType() const { - // If this is directly a member pointer type, return it. - if (const MemberPointerType *MTy = dyn_cast<MemberPointerType>(this)) - return MTy; - - // If the canonical form of this type isn't the right kind, reject it. - if (!isa<MemberPointerType>(CanonicalType)) { - // Look through type qualifiers - if (isa<MemberPointerType>(CanonicalType.getUnqualifiedType())) - return CanonicalType.getUnqualifiedType()->getAsMemberPointerType(); - return 0; - } - - // If this is a typedef for a member pointer type, strip the typedef off - // without losing all typedef information. - return cast<MemberPointerType>(getDesugaredType()); -} - /// isVariablyModifiedType (C99 6.7.5p3) - Return true for variable length /// array types and types that contain variable array types in their /// declarator @@ -379,7 +325,7 @@ bool Type::isVariablyModifiedType() const { return PT->getPointeeType()->isVariablyModifiedType(); if (const ReferenceType *RT = getAs<ReferenceType>()) return RT->getPointeeType()->isVariablyModifiedType(); - if (const MemberPointerType *PT = getAsMemberPointerType()) + if (const MemberPointerType *PT = getAs<MemberPointerType>()) return PT->getPointeeType()->isVariablyModifiedType(); // A function can return a variably modified type @@ -392,42 +338,6 @@ bool Type::isVariablyModifiedType() const { return false; } -const RecordType *Type::getAsRecordType() const { - // If this is directly a record type, return it. - if (const RecordType *RTy = dyn_cast<RecordType>(this)) - return RTy; - - // If the canonical form of this type isn't the right kind, reject it. - if (!isa<RecordType>(CanonicalType)) { - // Look through type qualifiers - if (isa<RecordType>(CanonicalType.getUnqualifiedType())) - return CanonicalType.getUnqualifiedType()->getAsRecordType(); - return 0; - } - - // If this is a typedef for a record type, strip the typedef off without - // losing all typedef information. - return cast<RecordType>(getDesugaredType()); -} - -const TagType *Type::getAsTagType() const { - // If this is directly a tag type, return it. - if (const TagType *TagTy = dyn_cast<TagType>(this)) - return TagTy; - - // If the canonical form of this type isn't the right kind, reject it. - if (!isa<TagType>(CanonicalType)) { - // Look through type qualifiers - if (isa<TagType>(CanonicalType.getUnqualifiedType())) - return CanonicalType.getUnqualifiedType()->getAsTagType(); - return 0; - } - - // If this is a typedef for a tag type, strip the typedef off without - // losing all typedef information. - return cast<TagType>(getDesugaredType()); -} - const RecordType *Type::getAsStructureType() const { // If this is directly a structure type, return it. if (const RecordType *RT = dyn_cast<RecordType>(this)) { diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 31623b9983..f956ecab7f 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -1201,7 +1201,7 @@ RegionStoreManager::BindStruct(const GRState *state, const TypedRegion* R, QualType T = R->getValueType(getContext()); assert(T->isStructureType()); - const RecordType* RT = T->getAsRecordType(); + const RecordType* RT = T->getAs<RecordType>(); RecordDecl* RD = RT->getDecl(); if (!RD->isDefinition()) diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp index 9147f93eda..66b99a85a3 100644 --- a/lib/Analysis/Store.cpp +++ b/lib/Analysis/Store.cpp @@ -36,7 +36,7 @@ StoreManager::MakeElementRegion(const GRState *state, const MemRegion *region, } static bool IsCompleteType(ASTContext &Ctx, QualType Ty) { - if (const RecordType *RT = Ty->getAsRecordType()) { + if (const RecordType *RT = Ty->getAs<RecordType>()) { const RecordDecl *D = RT->getDecl(); if (!D->getDefinition(Ctx)) return false; diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 07f387f83f..9031caf505 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -179,7 +179,7 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest, assert(Dest && "Must have a destination!"); const CXXRecordDecl *RD = - cast<CXXRecordDecl>(E->getType()->getAsRecordType()->getDecl()); + cast<CXXRecordDecl>(E->getType()->getAs<RecordType>()->getDecl()); if (RD->hasTrivialConstructor()) return; diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index e4192d66f3..58be86d2cb 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -253,7 +253,7 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) { } else { if (CGF.getContext().getLangOptions().NeXTRuntime) { QualType LHSTy = E->getLHS()->getType(); - if (const RecordType *FDTTy = LHSTy.getTypePtr()->getAsRecordType()) + if (const RecordType *FDTTy = LHSTy.getTypePtr()->getAs<RecordType>()) if (FDTTy->getDecl()->hasObjectMember()) { LValue RHS = CGF.EmitLValue(E->getRHS()); CGF.CGM.getObjCRuntime().EmitGCMemmoveCollectable(CGF, LHS.getAddress(), @@ -441,7 +441,7 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { // the disadvantage is that the generated code is more difficult for // the optimizer, especially with bitfields. unsigned NumInitElements = E->getNumInits(); - RecordDecl *SD = E->getType()->getAsRecordType()->getDecl(); + RecordDecl *SD = E->getType()->getAs<RecordType>()->getDecl(); unsigned CurInitVal = 0; if (E->getType()->isUnionType()) { diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 4f1f58fefd..dea207cc72 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -188,7 +188,7 @@ public: llvm::Constant *EmitStructInitialization(InitListExpr *ILE) { const llvm::StructType *SType = cast<llvm::StructType>(ConvertType(ILE->getType())); - RecordDecl *RD = ILE->getType()->getAsRecordType()->getDecl(); + RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl(); std::vector<llvm::Constant*> Elts; // Initialize the whole structure to zero. @@ -264,7 +264,7 @@ public: #ifndef NDEBUG // Make sure that it's really an empty and not a failure of // semantic analysis. - RecordDecl *RD = ILE->getType()->getAsRecordType()->getDecl(); + RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl(); for (RecordDecl::field_iterator Field = RD->field_begin(), FieldEnd = RD->field_end(); Field != FieldEnd; ++Field) diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index bb80be961b..02516d7608 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -3072,7 +3072,7 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI, if (FQT->isUnionType()) HasUnion = true; - BuildAggrIvarRecordLayout(FQT->getAsRecordType(), + BuildAggrIvarRecordLayout(FQT->getAs<RecordType>(), BytePos + FieldOffset, ForStrongLayout, HasUnion); continue; @@ -3097,7 +3097,7 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI, int OldIndex = IvarsInfo.size() - 1; int OldSkIndex = SkipIvars.size() -1; - |