[cfe-commits] r76193 - in /cfe/trunk: include/clang/AST/ include/clang/Analysis/PathSensitive/ lib/AST/ lib/Analysis/ lib/CodeGen/ lib/Frontend/ lib/Sema/
Fariborz Jahanian
fjahanian at apple.com
Fri Jul 17 17:03:55 PDT 2009
When I first saw the previous patch, I wondered the benefit of doing
that. We were replacing a real function call with call to an
instantiation of a function template. No one produced a rational
about the benefits gained (I am sure there is one). I am glad that at
least temporarily we are back to some thing that most of us can
comprehend.
- Thanks, Fariborz
On Jul 17, 2009, at 10:50 AM, Ted Kremenek wrote:
> Author: kremenek
> Date: Fri Jul 17 12:50:17 2009
> New Revision: 76193
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76193&view=rev
> Log:
> Per offline discussion with Steve Naroff, add back
> Type::getAsXXXType() methods
> until Doug Gregor's Type smart pointer code lands (or more
> discussion occurs).
> These methods just call the new Type::getAs<XXX> methods, so we
> still have
> reduced implementation redundancy. Having explicit getAsXXXType()
> methods makes
> it easier to set breakpoints in the debugger.
>
>
>
>
> - if (const RecordType *LHSRT = LHSTy->getAs<RecordType>()) { //
> C99 6.5.15p3
> - if (const RecordType *RHSRT = RHSTy->getAs<RecordType>())
> + if (const RecordType *LHSRT = LHSTy->getAsRecordType()) { //
> C99 6.5.15p3
> + if (const RecordType *RHSRT = RHSTy->getAsRecordType())
> if (LHSRT->getDecl() == RHSRT->getDecl())
> // "If both the operands have structure or union type, the
> result has
> // that type." This implies that CV qualifiers are dropped.
> @@ -3131,8 +3131,8 @@
> return LHSTy;
> }
> // The block pointer types aren't identical, continue checking.
> - QualType lhptee = LHSTy->getAs<BlockPointerType>()-
> >getPointeeType();
> - QualType rhptee = RHSTy->getAs<BlockPointerType>()-
> >getPointeeType();
> + QualType lhptee = LHSTy->getAsBlockPointerType()-
> >getPointeeType();
> + QualType rhptee = RHSTy->getAsBlockPointerType()-
> >getPointeeType();
>
> if (!Context.typesAreCompatible(lhptee.getUnqualifiedType(),
> rhptee.getUnqualifiedType())) {
> @@ -3206,8 +3206,8 @@
> // Check constraints for C object pointers types (C99 6.5.15p3,6).
> if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
> // get the "pointed to" types
> - QualType lhptee = LHSTy->getAs<PointerType>()->getPointeeType();
> - QualType rhptee = RHSTy->getAs<PointerType>()->getPointeeType();
> + QualType lhptee = LHSTy->getAsPointerType()->getPointeeType();
> + QualType rhptee = RHSTy->getAsPointerType()->getPointeeType();
>
> // ignore qualifiers on void (C99 6.5.15p3, clause 6)
> if (lhptee->isVoidType() && rhptee->isIncompleteOrObjectType()) {
> @@ -3313,8 +3313,8 @@
> QualType lhptee, rhptee;
>
> // get the "pointed to" type (ignoring qualifiers at the top level)
> - lhptee = lhsType->getAs<PointerType>()->getPointeeType();
> - rhptee = rhsType->getAs<PointerType>()->getPointeeType();
> + lhptee = lhsType->getAsPointerType()->getPointeeType();
> + rhptee = rhsType->getAsPointerType()->getPointeeType();
>
> return CheckPointeeTypesForAssignment(lhptee, rhptee);
> }
> @@ -3396,8 +3396,8 @@
> QualType lhptee, rhptee;
>
> // get the "pointed to" type (ignoring qualifiers at the top level)
> - lhptee = lhsType->getAs<BlockPointerType>()->getPointeeType();
> - rhptee = rhsType->getAs<BlockPointerType>()->getPointeeType();
> + lhptee = lhsType->getAsBlockPointerType()->getPointeeType();
> + rhptee = rhsType->getAsBlockPointerType()->getPointeeType();
>
> // make sure we operate on the canonical type
> lhptee = Context.getCanonicalType(lhptee);
> @@ -3447,7 +3447,7 @@
> // right-hand side type. The caller is responsible for adjusting
> // lhsType so that the resulting expression does not have reference
> // type.
> - if (const ReferenceType *lhsTypeRef = lhsType-
> >getAs<ReferenceType>()) {
> + if (const ReferenceType *lhsTypeRef = lhsType-
> >getAsReferenceType()) {
> if (Context.typesAreCompatible(lhsTypeRef->getPointeeType(),
> rhsType))
> return Compatible;
> return Incompatible;
> @@ -3496,12 +3496,12 @@
>
> if (isa<ObjCObjectPointerType>(rhsType)) {
> QualType rhptee = rhsType->getAsObjCObjectPointerType()-
> >getPointeeType();
> - QualType lhptee = lhsType->getAs<PointerType>()-
> >getPointeeType();
> + QualType lhptee = lhsType->getAsPointerType()-
> >getPointeeType();
> return CheckPointeeTypesForAssignment(lhptee, rhptee);
> }
>
> - if (rhsType->getAs<BlockPointerType>()) {
> - if (lhsType->getAs<PointerType>()->getPointeeType()-
> >isVoidType())
> + if (rhsType->getAsBlockPointerType()) {
> + if (lhsType->getAsPointerType()->getPointeeType()-
> >isVoidType())
> return Compatible;
>
> // Treat block pointers as objects.
> @@ -3522,7 +3522,7 @@
> if (rhsType->isBlockPointerType())
> return CheckBlockPointerTypesForAssignment(lhsType, rhsType);
>
> - if (const PointerType *RHSPT = rhsType->getAs<PointerType>()) {
> + if (const PointerType *RHSPT = rhsType->getAsPointerType()) {
> if (RHSPT->getPointeeType()->isVoidType())
> return Compatible;
> }
> @@ -3535,7 +3535,7 @@
>
> if (isa<PointerType>(rhsType)) {
> QualType lhptee = lhsType->getAsObjCObjectPointerType()-
> >getPointeeType();
> - QualType rhptee = rhsType->getAs<PointerType>()-
> >getPointeeType();
> + QualType rhptee = rhsType->getAsPointerType()-
> >getPointeeType();
> return CheckPointeeTypesForAssignment(lhptee, rhptee);
> }
> if (rhsType->isObjCObjectPointerType()) {
> @@ -3545,7 +3545,7 @@
> QualType rhptee = rhsType->getAsObjCObjectPointerType()-
> >getPointeeType();
> return CheckPointeeTypesForAssignment(lhptee, rhptee);
> }
> - if (const PointerType *RHSPT = rhsType->getAs<PointerType>()) {
> + if (const PointerType *RHSPT = rhsType->getAsPointerType()) {
> if (RHSPT->getPointeeType()->isVoidType())
> return Compatible;
> }
> @@ -3566,7 +3566,7 @@
> return CheckPointerTypesForAssignment(lhsType, rhsType);
>
> if (isa<BlockPointerType>(lhsType) &&
> - rhsType->getAs<PointerType>()->getPointeeType()-
> >isVoidType())
> + rhsType->getAsPointerType()->getPointeeType()->isVoidType())
> return Compatible;
> return Incompatible;
> }
> @@ -3580,11 +3580,11 @@
>
> if (isa<PointerType>(lhsType)) {
> QualType rhptee = lhsType->getAsObjCObjectPointerType()-
> >getPointeeType();
> - QualType lhptee = rhsType->getAs<PointerType>()-
> >getPointeeType();
> + QualType lhptee = rhsType->getAsPointerType()-
> >getPointeeType();
> return CheckPointeeTypesForAssignment(lhptee, rhptee);
> }
> if (isa<BlockPointerType>(lhsType) &&
> - rhsType->getAs<PointerType>()->getPointeeType()-
> >isVoidType())
> + rhsType->getAsPointerType()->getPointeeType()->isVoidType())
> return Compatible;
> return Incompatible;
> }
> @@ -3636,7 +3636,7 @@
> // 1) void pointer
> // 2) null pointer constant
> if (FromType->isPointerType())
> - if (FromType->getAs<PointerType>()->getPointeeType()-
> >isVoidType()) {
> + if (FromType->getAsPointerType()->getPointeeType()-
> >isVoidType()) {
> ImpCastExprToType(rExpr, it->getType());
> InitField = *it;
> break;
> @@ -3973,7 +3973,7 @@
> }
>
> // Handle pointer-pointer subtractions.
> - if (const PointerType *RHSPTy = rex->getType()-
> >getAs<PointerType>()) {
> + if (const PointerType *RHSPTy = rex->getType()-
> >getAsPointerType()) {
> QualType rpointee = RHSPTy->getPointeeType();
>
> // RHS must be a completely-type object type.
> @@ -4168,9 +4168,9 @@
> // errors (when -pedantic-errors is enabled).
> if (lType->isPointerType() && rType->isPointerType()) { // C99
> 6.5.8p2
> QualType LCanPointeeTy =
> - Context.getCanonicalType(lType->getAs<PointerType>()-
> >getPointeeType());
> + Context.getCanonicalType(lType->getAsPointerType()-
> >getPointeeType());
> QualType RCanPointeeTy =
> - Context.getCanonicalType(rType->getAs<PointerType>()-
> >getPointeeType());
> + Context.getCanonicalType(rType->getAsPointerType()-
> >getPointeeType());
>
> if (isRelational) {
> if (lType->isFunctionPointerType() || rType-
> >isFunctionPointerType()) {
> @@ -4240,8 +4240,8 @@
> }
> // Handle block pointer types.
> if (!isRelational && lType->isBlockPointerType() && rType-
> >isBlockPointerType()) {
> - QualType lpointee = lType->getAs<BlockPointerType>()-
> >getPointeeType();
> - QualType rpointee = rType->getAs<BlockPointerType>()-
> >getPointeeType();
> + QualType lpointee = lType->getAsBlockPointerType()-
> >getPointeeType();
> + QualType rpointee = rType->getAsBlockPointerType()-
> >getPointeeType();
>
> if (!LHSIsNull && !RHSIsNull &&
> !Context.typesAreCompatible(lpointee, rpointee)) {
> @@ -4256,9 +4256,9 @@
> && ((lType->isBlockPointerType() && rType->isPointerType())
> || (lType->isPointerType() && rType-
> >isBlockPointerType()))) {
> if (!LHSIsNull && !RHSIsNull) {
> - if (!((rType->isPointerType() && rType->getAs<PointerType>()
> + if (!((rType->isPointerType() && rType->getAsPointerType()
> ->getPointeeType()->isVoidType())
> - || (lType->isPointerType() && lType->getAs<PointerType>()
> + || (lType->isPointerType() && lType->getAsPointerType()
> ->getPointeeType()->isVoidType())))
> Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
> << lType << rType << lex->getSourceRange() << rex-
> >getSourceRange();
> @@ -4269,8 +4269,8 @@
>
> if ((lType->isObjCObjectPointerType() || rType-
> >isObjCObjectPointerType())) {
> if (lType->isPointerType() || rType->isPointerType()) {
> - const PointerType *LPT = lType->getAs<PointerType>();
> - const PointerType *RPT = rType->getAs<PointerType>();
> + const PointerType *LPT = lType->getAsPointerType();
> + const PointerType *RPT = rType->getAsPointerType();
> bool LPtrToVoid = LPT ?
> Context.getCanonicalType(LPT->getPointeeType())-
> >isVoidType() : false;
> bool RPtrToVoid = RPT ?
> @@ -4798,7 +4798,7 @@
> // incomplete type or void. It would be possible to warn about
> dereferencing
> // a void pointer, but it's completely well-defined, and such a
> warning is
> // unlikely to catch any mistakes.
> - if (const PointerType *PT = Ty->getAs<PointerType>())
> + if (const PointerType *PT = Ty->getAsPointerType())
> return PT->getPointeeType();
>
> if (const ObjCObjectPointerType *OPT = Ty-
> >getAsObjCObjectPointerType())
> @@ -5256,7 +5256,7 @@
> continue;
> }
>
> - const RecordType *RC = Res->getType()->getAs<RecordType>();
> + const RecordType *RC = Res->getType()->getAsRecordType();
> if (!RC) {
> Res->Destroy(Context);
> return ExprError(Diag(OC.LocEnd,
> diag::err_offsetof_record_type)
>
> Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jul 17 12:50:17 2009
> @@ -83,7 +83,7 @@
> Expr *E = static_cast<Expr *>(TyOrExpr);
> if (E && !E->isTypeDependent() && E->isLvalue(Context) ==
> Expr::LV_Valid) {
> QualType T = E->getType();
> - if (const RecordType *RecordT = T->getAs<RecordType>()) {
> + if (const RecordType *RecordT = T->getAsRecordType()) {
> CXXRecordDecl *RecordD = cast<CXXRecordDecl>(RecordT-
> >getDecl());
> if (RecordD->isPolymorphic())
> isUnevaluatedOperand = false;
> @@ -136,7 +136,7 @@
> // to an incomplete type other than (cv) void the program is ill-
> formed.
> QualType Ty = E->getType();
> int isPointer = 0;
> - if (const PointerType* Ptr = Ty->getAs<PointerType>()) {
> + if (const PointerType* Ptr = Ty->getAsPointerType()) {
> Ty = Ptr->getPointeeType();
> isPointer = 1;
> }
> @@ -211,7 +211,7 @@
> RParenLoc));
> }
>
> - if (const RecordType *RT = Ty->getAs<RecordType>()) {
> + if (const RecordType *RT = Ty->getAsRecordType()) {
> CXXRecordDecl *Record = cast<CXXRecordDecl>(RT->getDecl());
>
> // FIXME: We should always create a CXXTemporaryObjectExpr here
> unless
> @@ -414,7 +414,7 @@
> if (AllocType->isDependentType()) {
> // Skip all the checks.
> }
> - else if ((RT = AllocType->getAs<RecordType>()) &&
> + else if ((RT = AllocType->getAsRecordType()) &&
> !AllocType->isAggregateType()) {
> Constructor = PerformInitializationByConstructor(
> AllocType, ConsArgs, NumConsArgs,
> @@ -516,7 +516,7 @@
> IsArray ? OO_Array_New :
> OO_New);
> if (AllocType->isRecordType() && !UseGlobal) {
> CXXRecordDecl *Record
> - = cast<CXXRecordDecl>(AllocType->getAs<RecordType>()-
> >getDecl());
> + = cast<CXXRecordDecl>(AllocType->getAsRecordType()->getDecl());
> // FIXME: We fail to find inherited overloads.
> if (FindAllocationOverload(StartLoc, Range, NewName,
> &AllocArgs[0],
> AllocArgs.size(), Record, /*AllowMissing=*/
> true,
> @@ -708,7 +708,7 @@
> return ExprError(Diag(StartLoc, diag::err_delete_operand)
> << Type << Ex->getSourceRange());
>
> - QualType Pointee = Type->getAs<PointerType>()->getPointeeType();
> + QualType Pointee = Type->getAsPointerType()->getPointeeType();
> if (Pointee->isFunctionType() || Pointee->isVoidType())
> return ExprError(Diag(StartLoc, diag::err_delete_operand)
> << Type << Ex->getSourceRange());
> @@ -757,7 +757,7 @@
> } else if (Ty->isArrayType()) { // ...or an array.
> Diag(StartLoc, diag::err_invalid_use_of_array_type)
> << SourceRange(StartLoc, EqualLoc);
> - } else if (const RecordType *RT = Ty->getAs<RecordType>()) {
> + } else if (const RecordType *RT = Ty->getAsRecordType()) {
> RecordDecl *RD = RT->getDecl();
> // The type-specifier-seq shall not declare a new class...
> if (RD->isDefinition() &&
> @@ -812,7 +812,7 @@
> // string literal can be converted to an rvalue of type "pointer
> // to wchar_t" (C++ 4.2p2).
> if (StringLiteral *StrLit = dyn_cast<StringLiteral>(From))
> - if (const PointerType *ToPtrType = ToType->getAs<PointerType>())
> + if (const PointerType *ToPtrType = ToType->getAsPointerType())
> if (const BuiltinType *ToPointeeType
> = ToPtrType->getPointeeType()->getAsBuiltinType()) {
> // This conversion is considered only when there is an
> @@ -1051,7 +1051,7 @@
> // be of type "pointer to member of T" (where T is a completely-
> defined
> // class type) [...]
> QualType RType = rex->getType();
> - const MemberPointerType *MemPtr = RType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *MemPtr = RType->getAsMemberPointerType();
> if (!MemPtr) {
> Diag(Loc, diag::err_bad_memptr_rhs)
> << OpSpelling << RType << rex->getSourceRange();
> @@ -1066,7 +1066,7 @@
> // such a class]
> QualType LType = lex->getType();
> if (isIndirect) {
> - if (const PointerType *Ptr = LType->getAs<PointerType>())
> + if (const PointerType *Ptr = LType->getAsPointerType())
> LType = Ptr->getPointeeType().getNonReferenceType();
> else {
> Diag(Loc, diag::err_bad_memptr_lhs)
> @@ -1163,8 +1163,8 @@
> // the same or one is a base class of the other:
> QualType FTy = From->getType();
> QualType TTy = To->getType();
> - const RecordType *FRec = FTy->getAs<RecordType>();
> - const RecordType *TRec = TTy->getAs<RecordType>();
> + const RecordType *FRec = FTy->getAsRecordType();
> + const RecordType *TRec = TTy->getAsRecordType();
> bool FDerivedFromT = FRec && TRec && Self.IsDerivedFrom(FTy, TTy);
> if (FRec && TRec && (FRec == TRec ||
> FDerivedFromT || Self.IsDerivedFrom(TTy, FTy))) {
> @@ -1418,8 +1418,8 @@
> // containing class, and second-level cv-ness.
> // cv-ness is not a union, but must match one of the two operands.
> (Which,
> // frankly, is stupid.)
> - const MemberPointerType *LMemPtr = LTy->getAs<MemberPointerType>();
> - const MemberPointerType *RMemPtr = RTy->getAs<MemberPointerType>();
> + const MemberPointerType *LMemPtr = LTy->getAsMemberPointerType();
> + const MemberPointerType *RMemPtr = RTy->getAsMemberPointerType();
> if (LMemPtr && RHS->isNullPointerConstant(Context)) {
> ImpCastExprToType(RHS, LTy);
> return LTy;
> @@ -1515,8 +1515,8 @@
> llvm::SmallVector<unsigned, 4> QualifierUnion;
> QualType Composite1 = T1, Composite2 = T2;
> const PointerType *Ptr1, *Ptr2;
> - while ((Ptr1 = Composite1->getAs<PointerType>()) &&
> - (Ptr2 = Composite2->getAs<PointerType>())) {
> + while ((Ptr1 = Composite1->getAsPointerType()) &&
> + (Ptr2 = Composite2->getAsPointerType())) {
> Composite1 = Ptr1->getPointeeType();
> Composite2 = Ptr2->getPointeeType();
> QualifierUnion.push_back(
> @@ -1562,7 +1562,7 @@
> }
>
> Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
> - const RecordType *RT = E->getType()->getAs<RecordType>();
> + const RecordType *RT = E->getType()->getAsRecordType();
> if (!RT)
> return Owned(E);
>
>
> Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Jul 17 12:50:17 2009
> @@ -859,7 +859,7 @@
> if (!lhs->isPointerType())
> return false;
>
> - QualType ltype = lhs->getAs<PointerType>()->getPointeeType();
> + QualType ltype = lhs->getAsPointerType()->getPointeeType();
> if (const ObjCQualifiedInterfaceType *lhsQI =
> ltype->getAsObjCQualifiedInterfaceType()) {
> ObjCObjectPointerType::qual_iterator LHSProtoI = lhsQI-
> >qual_begin();
>
> Modified: cfe/trunk/lib/Sema/SemaInherit.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaInherit.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaInherit.cpp Fri Jul 17 12:50:17 2009
> @@ -114,7 +114,7 @@
> return false;
>
> Paths.setOrigin(Derived);
> - return LookupInBases(cast<CXXRecordDecl>(Derived-
> >getAs<RecordType>()->getDecl()),
> + return LookupInBases(cast<CXXRecordDecl>(Derived-
> >getAsRecordType()->getDecl()),
> MemberLookupCriteria(Base), Paths);
> }
>
> @@ -156,7 +156,7 @@
> if (Paths.isDetectingVirtual() && Paths.DetectedVirtual == 0) {
> // If this is the first virtual we find, remember it. If it
> turns out
> // there is no base path here, we'll reset it later.
> - Paths.DetectedVirtual = BaseType->getAs<RecordType>();
> + Paths.DetectedVirtual = BaseType->getAsRecordType();
> SetVirtual = true;
> }
> } else
> @@ -175,7 +175,7 @@
> }
>
> CXXRecordDecl *BaseRecord
> - = cast<CXXRecordDecl>(BaseSpec->getType()-
> >getAs<RecordType>()->getDecl());
> + = cast<CXXRecordDecl>(BaseSpec->getType()->getAsRecordType()-
> >getDecl());
>
> // Either look at the base class type or look into the base class
> // type to see if we've found a member that meets the search
>
> Modified: cfe/trunk/lib/Sema/SemaInit.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaInit.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Jul 17 12:50:17 2009
> @@ -162,7 +162,7 @@
> if ((DeclTypeC.getUnqualifiedType() ==
> InitTypeC.getUnqualifiedType()) ||
> IsDerivedFrom(InitTypeC, DeclTypeC)) {
> const CXXRecordDecl *RD =
> - cast<CXXRecordDecl>(DeclType->getAs<RecordType>()-
> >getDecl());
> + cast<CXXRecordDecl>(DeclType->getAsRecordType()-
> >getDecl());
>
> // No need to make a CXXConstructExpr if both the ctor and
> dtor are
> // trivial.
> @@ -341,7 +341,7 @@
> if (ILE->getSyntacticForm())
> Loc = ILE->getSyntacticForm()->getSourceRange().getBegin();
>
> - if (const RecordType *RType = ILE->getType()-
> >getAs<RecordType>()) {
> + if (const RecordType *RType = ILE->getType()->getAsRecordType()) {
> unsigned Init = 0, NumInits = ILE->getNumInits();
> for (RecordDecl::field_iterator
> Field = RType->getDecl()->field_begin(),
> @@ -447,7 +447,7 @@
> }
>
> int InitListChecker::numStructUnionElements(QualType DeclType) {
> - RecordDecl *structDecl = DeclType->getAs<RecordType>()->getDecl();
> + RecordDecl *structDecl = DeclType->getAsRecordType()->getDecl();
> int InitializableMembers = 0;
> for (RecordDecl::field_iterator
> Field = structDecl->field_begin(),
> @@ -584,7 +584,7 @@
> CheckVectorType(IList, DeclType, Index, StructuredList,
> StructuredIndex);
> } else if (DeclType->isAggregateType()) {
> if (DeclType->isRecordType()) {
> - RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
> + RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
> CheckStructUnionTypes(IList, DeclType, RD->field_begin(),
> SubobjectIsDesignatorContext, Index,
> StructuredList, StructuredIndex,
> @@ -939,7 +939,7 @@
> InitListExpr
> *StructuredList,
> unsigned &StructuredIndex,
> bool TopLevelObject) {
> - RecordDecl* structDecl = DeclType->getAs<RecordType>()->getDecl();
> + RecordDecl* structDecl = DeclType->getAsRecordType()->getDecl();
>
> // If the record is invalid, some of it's members are invalid. To
> avoid
> // confusion, we forgo checking the intializer for the entire
> record.
> @@ -950,7 +950,7 @@
>
> if (DeclType->isUnionType() && IList->getNumInits() == 0) {
> // Value-initialize the first named member of the union.
> - RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
> + RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
> for (RecordDecl::field_iterator FieldEnd = RD->field_end();
> Field != FieldEnd; ++Field) {
> if (Field->getDeclName()) {
> @@ -965,7 +965,7 @@
> // anything except look at designated initializers; That's okay,
> // because an error should get printed out elsewhere. It might be
> // worthwhile to skip over the rest of the initializer, though.
> - RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
> + RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
> RecordDecl::field_iterator FieldEnd = RD->field_end();
> bool InitializedSomething = false;
> while (Index < IList->getNumInits()) {
> @@ -1204,7 +1204,7 @@
> // then the current object (defined below) shall have
> // structure or union type and the identifier shall be the
> // name of a member of that type.
> - const RecordType *RT = CurrentObjectType->getAs<RecordType>();
> + const RecordType *RT = CurrentObjectType->getAsRecordType();
> if (!RT) {
> SourceLocation Loc = D->getDotLoc();
> if (Loc.isInvalid())
> @@ -1564,7 +1564,7 @@
> }
> } else if (const VectorType *VType = CurrentObjectType-
> >getAsVectorType())
> NumElements = VType->getNumElements();
> - else if (const RecordType *RType = CurrentObjectType-
> >getAs<RecordType>()) {
> + else if (const RecordType *RType = CurrentObjectType-
> >getAsRecordType()) {
> RecordDecl *RDecl = RType->getDecl();
> if (RDecl->isUnion())
> NumElements = 1;
> @@ -1758,7 +1758,7 @@
> if (const ArrayType *AT = Context.getAsArrayType(Type))
> return CheckValueInitialization(AT->getElementType(), Loc);
>
> - if (const RecordType *RT = Type->getAs<RecordType>()) {
> + if (const RecordType *RT = Type->getAsRecordType()) {
> if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT-
> >getDecl())) {
> // -- if T is a class type (clause 9) with a user-declared
> // constructor (12.1), then the default constructor for T is
>
> Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Jul 17 12:50:17 2009
> @@ -1387,7 +1387,7 @@
> for (CXXRecordDecl::base_class_iterator Base = Class-
> >bases_begin(),
> BaseEnd = Class->bases_end();
> Base != BaseEnd; ++Base) {
> - const RecordType *BaseType = Base->getType()-
> >getAs<RecordType>();
> + const RecordType *BaseType = Base->getType()-
> >getAsRecordType();
> CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(BaseType-
> >getDecl());
> if (AssociatedClasses.insert(BaseDecl)) {
> // Find the associated namespace for this base class.
> @@ -1435,7 +1435,7 @@
> // We handle this by unwrapping pointer and array types immediately,
> // to avoid unnecessary recursion.
> while (true) {
> - if (const PointerType *Ptr = T->getAs<PointerType>())
> + if (const PointerType *Ptr = T->getAsPointerType())
> T = Ptr->getPointeeType();
> else if (const ArrayType *Ptr = Context.getAsArrayType(T))
> T = Ptr->getElementType();
> @@ -1453,7 +1453,7 @@
> // member, if any; and its direct and indirect base
> // classes. Its associated namespaces are the namespaces in
> // which its associated classes are defined.
> - if (const RecordType *ClassType = T->getAs<RecordType>())
> + if (const RecordType *ClassType = T->getAsRecordType())
> if (CXXRecordDecl *ClassDecl
> = dyn_cast<CXXRecordDecl>(ClassType->getDecl())) {
> addAssociatedClassesAndNamespaces(ClassDecl, Context,
> @@ -1519,7 +1519,7 @@
> // associated namespaces and classes are those associated
> // with the member type together with those associated with
> // X.
> - if (const MemberPointerType *MemberPtr = T-
> >getAs<MemberPointerType>()) {
> + if (const MemberPointerType *MemberPtr = T-
> >getAsMemberPointerType()) {
> // Handle the type that the pointer to member points to.
> addAssociatedClassesAndNamespaces(MemberPtr->getPointeeType(),
> Context,
> @@ -1527,7 +1527,7 @@
> GlobalScope);
>
> // Handle the class type into which this points.
> - if (const RecordType *Class = MemberPtr->getClass()-
> >getAs<RecordType>())
> + if (const RecordType *Class = MemberPtr->getClass()-
> >getAsRecordType())
> addAssociatedClassesAndNamespaces(cast<CXXRecordDecl>(Class-
> >getDecl()),
> Context,
> AssociatedNamespaces,
> AssociatedClasses,
>
> Modified: cfe/trunk/lib/Sema/SemaNamedCast.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaNamedCast.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaNamedCast.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaNamedCast.cpp Fri Jul 17 12:50:17 2009
> @@ -118,7 +118,7 @@
> DestType = Self.Context.getCanonicalType(DestType);
> QualType SrcType = SrcExpr->getType();
> if (const LValueReferenceType *DestTypeTmp =
> - DestType->getAs<LValueReferenceType>()) {
> + DestType->getAsLValueReferenceType()) {
> if (SrcExpr->isLvalue(Self.Context) != Expr::LV_Valid) {
> // Cannot cast non-lvalue to lvalue reference type.
> Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
> @@ -220,7 +220,7 @@
> DestType = Self.Context.getCanonicalType(DestType);
> QualType SrcType = SrcExpr->getType();
> if (const LValueReferenceType *DestTypeTmp =
> - DestType->getAs<LValueReferenceType>()) {
> + DestType->getAsLValueReferenceType()) {
> if (SrcExpr->isLvalue(Self.Context) != Expr::LV_Valid) {
> // Cannot cast non-lvalue to reference type.
> Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
> @@ -235,7 +235,7 @@
> DestType = Self.Context.getPointerType(DestTypeTmp-
> >getPointeeType());
> SrcType = Self.Context.getPointerType(SrcType);
> } else if (const RValueReferenceType *DestTypeTmp =
> - DestType->getAs<RValueReferenceType>()) {
> + DestType->getAsRValueReferenceType()) {
> // Both the reference conversion and the rvalue rules apply.
> Self.DefaultFunctionArrayConversion(SrcExpr);
> SrcType = SrcExpr->getType();
> @@ -253,8 +253,8 @@
> // Canonicalize source for comparison.
> SrcType = Self.Context.getCanonicalType(SrcType);
>
> - const MemberPointerType *DestMemPtr = DestType-
> >getAs<MemberPointerType>(),
> - *SrcMemPtr = SrcType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *DestMemPtr = DestType-
> >getAsMemberPointerType(),
> + *SrcMemPtr = SrcType-
> >getAsMemberPointerType();
> if (DestMemPtr && SrcMemPtr) {
> // C++ 5.2.10p9: An rvalue of type "pointer to member of X of
> type T1"
> // can be explicitly converted to an rvalue of type "pointer
> to member
> @@ -529,10 +529,10 @@
> // Reverse pointer conversion to void*. C++ 4.10.p2 specifies
> conversion to
> // void*. C++ 5.2.9p10 specifies additional restrictions, which
> really is
> // just the usual constness stuff.
> - if (const PointerType *SrcPointer = SrcType-
> >getAs<PointerType>()) {
> + if (const PointerType *SrcPointer = SrcType->getAsPointerType()) {
> QualType SrcPointee = SrcPointer->getPointeeType();
> if (SrcPointee->isVoidType()) {
> - if (const PointerType *DestPointer = DestType-
> >getAs<PointerType>()) {
> + if (const PointerType *DestPointer = DestType-
> >getAsPointerType()) {
> QualType DestPointee = DestPointer->getPointeeType();
> if (DestPointee->isIncompleteOrObjectType()) {
> // This is definitely the intended conversion, but it
> might fail due
> @@ -563,7 +563,7 @@
> {
> // N2844 5.2.9p3: An lvalue of type "cv1 T1" can be cast to type
> "rvalue
> // reference to cv2 T2" if "cv2 T2" is reference-compatible with
> "cv1 T1".
> - const RValueReferenceType *R = DestType-
> >getAs<RValueReferenceType>();
> + const RValueReferenceType *R = DestType-
> >getAsRValueReferenceType();
> if (!R)
> return TSC_NotApplicable;
>
> @@ -604,7 +604,7 @@
> return TSC_NotApplicable;
> }
>
> - const ReferenceType *DestReference = DestType-
> >getAs<ReferenceType>();
> + const ReferenceType *DestReference = DestType-
> >getAsReferenceType();
> if (!DestReference) {
> return TSC_NotApplicable;
> }
> @@ -627,12 +627,12 @@
> // In addition, DR54 clarifies that the base must be accessible in
> the
> // current context.
>
> - const PointerType *SrcPointer = SrcType->getAs<PointerType>();
> + const PointerType *SrcPointer = SrcType->getAsPointerType();
> if (!SrcPointer) {
> return TSC_NotApplicable;
> }
>
> - const PointerType *DestPointer = DestType->getAs<PointerType>();
> + const PointerType *DestPointer = DestType->getAsPointerType();
> if (!DestPointer) {
> return TSC_NotApplicable;
> }
> @@ -738,10 +738,10 @@
> TryStaticMemberPointerUpcast(Sema &Self, QualType SrcType, QualType
> DestType,
> const SourceRange &OpRange)
> {
> - const MemberPointerType *SrcMemPtr = SrcType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *SrcMemPtr = SrcType-
> >getAsMemberPointerType();
> if (!SrcMemPtr)
> return TSC_NotApplicable;
> - const MemberPointerType *DestMemPtr = DestType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *DestMemPtr = DestType-
> >getAsMemberPointerType();
> if (!DestMemPtr)
> return TSC_NotApplicable;
>
> @@ -828,8 +828,8 @@
> // or "pointer to cv void".
>
> QualType DestPointee;
> - const PointerType *DestPointer = DestType->getAs<PointerType>();
> - const ReferenceType *DestReference = DestType-
> >getAs<ReferenceType>();
> + const PointerType *DestPointer = DestType->getAsPointerType();
> + const ReferenceType *DestReference = DestType-
> >getAsReferenceType();
> if (DestPointer) {
> DestPointee = DestPointer->getPointeeType();
> } else if (DestReference) {
> @@ -840,7 +840,7 @@
> return;
> }
>
> - const RecordType *DestRecord = DestPointee->getAs<RecordType>();
> + const RecordType *DestRecord = DestPointee->getAsRecordType();
> if (DestPointee->isVoidType()) {
> assert(DestPointer && "Reference to void is not possible");
> } else if (DestRecord) {
> @@ -863,7 +863,7 @@
> QualType SrcType = Self.Context.getCanonicalType(OrigSrcType);
> QualType SrcPointee;
> if (DestPointer) {
> - if (const PointerType *SrcPointer = SrcType-
> >getAs<PointerType>()) {
> + if (const PointerType *SrcPointer = SrcType-
> >getAsPointerType()) {
> SrcPointee = SrcPointer->getPointeeType();
> } else {
> Self.Diag(OpRange.getBegin(),
> diag::err_bad_dynamic_cast_not_ptr)
> @@ -880,7 +880,7 @@
> SrcPointee = SrcType;
> }
>
> - const RecordType *SrcRecord = SrcPointee->getAs<RecordType>();
> + const RecordType *SrcRecord = SrcPointee->getAsRecordType();
> if (SrcRecord) {
> if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee,
>
> diag::err_bad_dynamic_cast_incomplete,
>
> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Jul 17 12:50:17 2009
> @@ -173,7 +173,7 @@
> FromType = Context.getArrayDecayedType(FromType);
>
> if (Second == ICK_Pointer_Conversion)
> - if (const PointerType* ToPtrType = ToType->getAs<PointerType>())
> + if (const PointerType* ToPtrType = ToType->getAsPointerType())
> return ToPtrType->getPointeeType()->isVoidType();
>
> return false;
> @@ -915,7 +915,7 @@
>
> // Blocks: Block pointers can be converted to void*.
> if (FromType->isBlockPointerType() && ToType->isPointerType() &&
> - ToType->getAs<PointerType>()->getPointeeType()->isVoidType()) {
> + ToType->getAsPointerType()->getPointeeType()->isVoidType()) {
> ConvertedType = ToType;
> return true;
> }
> @@ -933,7 +933,7 @@
> return true;
> }
>
> - const PointerType* ToTypePtr = ToType->getAs<PointerType>();
> + const PointerType* ToTypePtr = ToType->getAsPointerType();
> if (!ToTypePtr)
> return false;
>
> @@ -944,7 +944,7 @@
> }
>
> // Beyond this point, both types need to be pointers.
> - const PointerType *FromTypePtr = FromType->getAs<PointerType>();
> + const PointerType *FromTypePtr = FromType->getAsPointerType();
> if (!FromTypePtr)
> return false;
>
> @@ -1042,17 +1042,17 @@
> }
> // Beyond this point, both types need to be C pointers or block
> pointers.
> QualType ToPointeeType;
> - if (const PointerType *ToCPtr = ToType->getAs<PointerType>())
> + if (const PointerType *ToCPtr = ToType->getAsPointerType())
> ToPointeeType = ToCPtr->getPointeeType();
> - else if (const BlockPointerType *ToBlockPtr = ToType-
> >getAs<BlockPointerType>())
> + else if (const BlockPointerType *ToBlockPtr = ToType-
> >getAsBlockPointerType())
> ToPointeeType = ToBlockPtr->getPointeeType();
> else
> return false;
>
> QualType FromPointeeType;
> - if (const PointerType *FromCPtr = FromType->getAs<PointerType>())
> + if (const PointerType *FromCPtr = FromType->getAsPointerType())
> FromPointeeType = FromCPtr->getPointeeType();
> - else if (const BlockPointerType *FromBlockPtr = FromType-
> >getAs<BlockPointerType>())
> + else if (const BlockPointerType *FromBlockPtr = FromType-
> >getAsBlockPointerType())
> FromPointeeType = FromBlockPtr->getPointeeType();
> else
> return false;
> @@ -1142,8 +1142,8 @@
> bool Sema::CheckPointerConversion(Expr *From, QualType ToType) {
> QualType FromType = From->getType();
>
> - if (const PointerType *FromPtrType = FromType-
> >getAs<PointerType>())
> - if (const PointerType *ToPtrType = ToType-
> >getAs<PointerType>()) {
> + if (const PointerType *FromPtrType = FromType->getAsPointerType())
> + if (const PointerType *ToPtrType = ToType->getAsPointerType()) {
> QualType FromPointeeType = FromPtrType->getPointeeType(),
> ToPointeeType = ToPtrType->getPointeeType();
>
> @@ -1178,7 +1178,7 @@
> bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
> QualType ToType, QualType
> &ConvertedType)
> {
> - const MemberPointerType *ToTypePtr = ToType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *ToTypePtr = ToType-
> >getAsMemberPointerType();
> if (!ToTypePtr)
> return false;
>
> @@ -1189,7 +1189,7 @@
> }
>
> // Otherwise, both types have to be member pointers.
> - const MemberPointerType *FromTypePtr = FromType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *FromTypePtr = FromType-
> >getAsMemberPointerType();
> if (!FromTypePtr)
> return false;
>
> @@ -1216,11 +1216,11 @@
> /// otherwise.
> bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType) {
> QualType FromType = From->getType();
> - const MemberPointerType *FromPtrType = FromType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *FromPtrType = FromType-
> >getAsMemberPointerType();
> if (!FromPtrType)
> return false;
>
> - const MemberPointerType *ToPtrType = ToType-
> >getAs<MemberPointerType>();
> + const MemberPointerType *ToPtrType = ToType-
> >getAsMemberPointerType();
> assert(ToPtrType && "No member pointer cast has a target type "
> "that is not a member pointer.");
>
> @@ -1340,7 +1340,7 @@
> bool AllowExplicit, bool
> ForceRValue)
> {
> OverloadCandidateSet CandidateSet;
> - if (const RecordType *ToRecordType = ToType->getAs<RecordType>()) {
> + if (const RecordType *ToRecordType = ToType->getAsRecordType()) {
> if (CXXRecordDecl *ToRecordDecl
> = dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) {
> // C++ [over.match.ctor]p1:
> @@ -1369,7 +1369,7 @@
> if (!AllowConversionFunctions) {
> // Don't allow any conversion functions to enter the overload set.
> } else if (const RecordType *FromRecordType
> - = From->getType()->getAs<RecordType>()) {
> + = From->getType()->getAsRecordType()) {
> if (CXXRecordDecl *FromRecordDecl
> = dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
> // Add all of the conversion functions as candidates.
> @@ -1404,7 +1404,7 @@
> User.ConversionFunction = Constructor;
> User.After.setAsIdentityConversion();
> User.After.FromTypePtr
> - = ThisType->getAs<PointerType>()-
> >getPointeeType().getAsOpaquePtr();
> + = ThisType->getAsPointerType()-
> >getPointeeType().getAsOpaquePtr();
> User.After.ToTypePtr = ToType.getAsOpaquePtr();
> return true;
> } else if (CXXConversionDecl *Conversion
> @@ -1579,9 +1579,9 @@
> FromType2 = Context.getArrayDecayedType(FromType2);
>
> QualType FromPointee1
> - = FromType1->getAs<PointerType>()-
> >getPointeeType().getUnqualifiedType();
> + = FromType1->getAsPointerType()-
> >getPointeeType().getUnqualifiedType();
> QualType FromPointee2
> - = FromType2->getAs<PointerType>()-
> >getPointeeType().getUnqualifiedType();
> + = FromType2->getAsPointerType()-
> >getPointeeType().getUnqualifiedType();
>
> if (IsDerivedFrom(FromPointee2, FromPointee1))
> return ImplicitConversionSequence::Better;
> @@ -1771,13 +1771,13 @@
> FromType1->isPointerType() && FromType2->isPointerType() &&
> ToType1->isPointerType() && ToType2->isPointerType()) {
> QualType FromPointee1
> - = FromType1->getAs<PointerType>()-
> >getPointeeType().getUnqualifiedType();
> + = FromType1->getAsPointerType()-
> >getPointeeType().getUnqualifiedType();
> QualType ToPointee1
> - = ToType1->getAs<PointerType>()-
> >getPointeeType().getUnqualifiedType();
> + = ToType1->getAsPointerType()-
> >getPointeeType().getUnqualifiedType();
> QualType FromPointee2
> - = FromType2->getAs<PointerType>()-
> >getPointeeType().getUnqualifiedType();
> + = FromType2->getAsPointerType()-
> >getPointeeType().getUnqualifiedType();
> QualType ToPointee2
> - = ToType2->getAs<PointerType>()-
> >getPointeeType().getUnqualifiedType();
> + = ToType2->getAsPointerType()-
> >getPointeeType().getUnqualifiedType();
>
> const ObjCInterfaceType* FromIface1 = FromPointee1-
> >getAsObjCInterfaceType();
> const ObjCInterfaceType* FromIface2 = FromPointee2-
> >getAsObjCInterfaceType();
> @@ -1943,7 +1943,7 @@
>
> // We need to have an object of class type.
> QualType FromType = From->getType();
> - if (const PointerType *PT = FromType->getAs<PointerType>())
> + if (const PointerType *PT = FromType->getAsPointerType())
> FromType = PT->getPointeeType();
>
> assert(FromType->isRecordType());
> @@ -1991,9 +1991,9 @@
> Sema::PerformObjectArgumentInitialization(Expr *&From, CXXMethodDecl
> *Method) {
> QualType FromRecordType, DestType;
> QualType ImplicitParamRecordType =
> - Method->getThisType(Context)->getAs<PointerType>()-
> >getPointeeType();
> + Method->getThisType(Context)->getAsPointerType()-
> >getPointeeType();
>
> - if (const PointerType *PT = From->getType()-
> >getAs<PointerType>()) {
> + if (const PointerType *PT = From->getType()->getAsPointerType()) {
> FromRecordType = PT->getPointeeType();
> DestType = Method->getThisType(Context);
> } else {
> @@ -2500,7 +2500,7 @@
> // (13.3.1.1.1); otherwise, the set of member candidates is
> // empty.
> // FIXME: Lookup in base classes, too!
> - if (const RecordType *T1Rec = T1->getAs<RecordType>()) {
> + if (const RecordType *T1Rec = T1->getAsRecordType()) {
> DeclContext::lookup_const_iterator Oper, OperEnd;
> for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(OpName);
> Oper != OperEnd; ++Oper)
> @@ -2634,7 +2634,7 @@
> if (!PointerTypes.insert(Ty))
> return false;
>
> - if (const PointerType *PointerTy = Ty->getAs<PointerType>()) {
> + if (const PointerType *PointerTy = Ty->getAsPointerType()) {
> QualType PointeeTy = PointerTy->getPointeeType();
> // FIXME: Optimize this so that we don't keep trying to add the
> same types.
>
> @@ -2668,7 +2668,7 @@
> if (!MemberPointerTypes.insert(Ty))
> return false;
>
> - if (const MemberPointerType *PointerTy = Ty-
> >getAs<MemberPointerType>()) {
> + if (const MemberPointerType *PointerTy = Ty-
> >getAsMemberPointerType()) {
> QualType PointeeTy = PointerTy->getPointeeType();
> const Type *ClassTy = PointerTy->getClass();
> // FIXME: Optimize this so that we don't keep trying to add the
> same types.
> @@ -2704,13 +2704,13 @@
>
> // Look through reference types; they aren't part of the type of an
> // expression for the purposes of conversions.
> - if (const ReferenceType *RefTy = Ty->getAs<ReferenceType>())
> + if (const ReferenceType *RefTy = Ty->getAsReferenceType())
> Ty = RefTy->getPointeeType();
>
> // We don't care about qualifiers on the type.
> Ty = Ty.getUnqualifiedType();
>
> - if (const PointerType *PointerTy = Ty->getAs<PointerType>()) {
> + if (const PointerType *PointerTy = Ty->getAsPointerType()) {
> QualType PointeeTy = PointerTy->getPointeeType();
>
> // Insert our type, and its more-qualified variants, into the set
> @@ -2728,7 +2728,7 @@
> // If this is a pointer to a class type, add pointers to its bases
> // (with the same level of cv-qualification as the original
> // derived class, of course).
> - if (const RecordType *PointeeRec = PointeeTy-
> >getAs<RecordType>()) {
> + if (const RecordType *PointeeRec = PointeeTy-
> >getAsRecordType()) {
> CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(PointeeRec-
> >getDecl());
> for (CXXRecordDecl::base_class_iterator Base = ClassDecl-
> >bases_begin();
> Base != ClassDecl->bases_end(); ++Base) {
> @@ -2747,7 +2747,7 @@
> } else if (Ty->isEnumeralType()) {
> EnumerationTypes.insert(Ty);
> } else if (AllowUserConversions) {
> - if (const RecordType *TyRec = Ty->getAs<RecordType>()) {
> + if (const RecordType *TyRec = Ty->getAsRecordType()) {
> CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(TyRec-
> >getDecl());
> // FIXME: Visit conversion functions in the base classes, too.
> OverloadedFunctionDecl *Conversions
> @@ -2898,7 +2898,7 @@
> for (BuiltinCandidateTypeSet::iterator Ptr =
> CandidateTypes.pointer_begin();
> Ptr != CandidateTypes.pointer_end(); ++Ptr) {
> // Skip pointer types that aren't pointers to object types.
> - if (!(*Ptr)->getAs<PointerType>()->getPointeeType()-
> >isObjectType())
> + if (!(*Ptr)->getAsPointerType()->getPointeeType()-
> >isObjectType())
> continue;
>
> QualType ParamTypes[2] = {
> @@ -2936,7 +2936,7 @@
> for (BuiltinCandidateTypeSet::iterator Ptr =
> CandidateTypes.pointer_begin();
> Ptr != CandidateTypes.pointer_end(); ++Ptr) {
> QualType ParamTy = *Ptr;
> - QualType PointeeTy = ParamTy->getAs<PointerType>()-
> >getPointeeType();
> + QualType PointeeTy = ParamTy->getAsPointerType()-
> >getPointeeType();
> AddBuiltinCandidate(Context.getLValueReferenceType(PointeeTy),
> &ParamTy, Args, 1, CandidateSet);
> }
> @@ -3336,7 +3336,7 @@
> for (BuiltinCandidateTypeSet::iterator Ptr =
> CandidateTypes.pointer_begin();
> Ptr != CandidateTypes.pointer_end(); ++Ptr) {
> QualType ParamTypes[2] = { *Ptr, Context.getPointerDiffType() };
> - QualType PointeeType = (*Ptr)->getAs<PointerType>()-
> >getPointeeType();
> + QualType PointeeType = (*Ptr)->getAsPointerType()-
> >getPointeeType();
> QualType ResultTy = Context.getLValueReferenceType(PointeeType);
>
> // T& operator[](T*, ptrdiff_t)
> @@ -3616,15 +3616,15 @@
> bool isRValueReference = false;
> bool isPointer = false;
> if (const LValueReferenceType *FnTypeRef =
> - FnType->getAs<LValueReferenceType>()) {
> + FnType->getAsLValueReferenceType()) {
> FnType = FnTypeRef->getPointeeType();
> isLValueReference = true;
> } else if (const RValueReferenceType *FnTypeRef =
> - FnType->getAs<RValueReferenceType>()) {
> + FnType->getAsRValueReferenceType()) {
> FnType = FnTypeRef->getPointeeType();
> isRValueReference = true;
> }
> - if (const PointerType *FnTypePtr = FnType-
> >getAs<PointerType>()) {
> + if (const PointerType *FnTypePtr = FnType-
> >getAsPointerType()) {
> FnType = FnTypePtr->getPointeeType();
> isPointer = true;
> }
> @@ -3673,12 +3673,12 @@
> bool Complain) {
> QualType FunctionType = ToType;
> bool IsMember = false;
> - if (const PointerType *ToTypePtr = ToType->getAs<PointerType>())
> + if (const PointerType *ToTypePtr = ToType->getAsPointerType())
> FunctionType = ToTypePtr->getPointeeType();
> - else if (const ReferenceType *ToTypeRef = ToType-
> >getAs<ReferenceType>())
> + else if (const ReferenceType *ToTypeRef = ToType-
> >getAsReferenceType())
> FunctionType = ToTypeRef->getPointeeType();
> else if (const MemberPointerType *MemTypePtr =
> - ToType->getAs<MemberPointerType>()) {
> + ToType->getAsMemberPointerType()) {
> FunctionType = MemTypePtr->getPointeeType();
> IsMember = true;
> }
> @@ -4367,7 +4367,7 @@
> SourceLocation *CommaLocs,
> SourceLocation RParenLoc) {
> assert(Object->getType()->isRecordType() && "Requires object type
> argument");
> - const RecordType *Record = Object->getType()->getAs<RecordType>();
> + const RecordType *Record = Object->getType()->getAsRecordType();
>
> // C++ [over.call.object]p1:
> // If the primary-expression E in the function call syntax
> @@ -4414,7 +4414,7 @@
> // Strip the reference type (if any) and then the pointer type (if
> // any) to get down to what might be a function type.
> QualType ConvType = Conv-
> >getConversionType().getNonReferenceType();
> - if (const PointerType *ConvPtrType = ConvType-
> >getAs<PointerType>())
> + if (const PointerType *ConvPtrType = ConvType-
> >getAsPointerType())
> ConvType = ConvPtrType->getPointeeType();
>
> if (const FunctionProtoType *Proto = ConvType-
> >getAsFunctionProtoType())
> @@ -4579,7 +4579,7 @@
> // FIXME: look in base classes.
> DeclarationName OpName =
> Context.DeclarationNames.getCXXOperatorName(OO_Arrow);
> OverloadCandidateSet CandidateSet;
> - const RecordType *BaseRecord = Base->getType()-
> >getAs<RecordType>();
> + const RecordType *BaseRecord = Base->getType()->getAsRecordType();
>
> DeclContext::lookup_const_iterator Oper, OperEnd;
> for (llvm::tie(Oper, OperEnd)
>
> Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaStmt.cpp Fri Jul 17 12:50:17 2009
> @@ -1204,7 +1204,7 @@
> QualType ThrowType = ThrowExpr->getType();
> // Make sure the expression type is an ObjC pointer or "void *".
> if (!ThrowType->isObjCObjectPointerType()) {
> - const PointerType *PT = ThrowType->getAs<PointerType>();
> + const PointerType *PT = ThrowType->getAsPointerType();
> if (!PT || !PT->getPointeeType()->isVoidType())
> return StmtError(Diag(AtLoc,
> diag::error_objc_throw_expects_object)
> << ThrowExpr->getType() << ThrowExpr-
> >getSourceRange());
> @@ -1221,7 +1221,7 @@
> // Make sure the expression type is an ObjC pointer or "void *".
> Expr *SyncExpr = static_cast<Expr*>(SynchExpr.get());
> if (!SyncExpr->getType()->isObjCObjectPointerType()) {
> - const PointerType *PT = SyncExpr->getType()-
> >getAs<PointerType>();
> + const PointerType *PT = SyncExpr->getType()->getAsPointerType();
> if (!PT || !PT->getPointeeType()->isVoidType())
> return StmtError(Diag(AtLoc,
> diag::error_objc_synchronized_expects_object)
> << SyncExpr->getType() << SyncExpr-
> >getSourceRange());
>
> Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Jul 17 12:50:17 2009
> @@ -225,8 +225,8 @@
> if (T->isIntegralType() || T->isEnumeralType() ||
> // -- pointer to object or pointer to function,
> (T->isPointerType() &&
> - (T->getAs<PointerType>()->getPointeeType()->isObjectType() ||
> - T->getAs<PointerType>()->getPointeeType()-
> >isFunctionType())) ||
> + (T->getAsPointerType()->getPointeeType()->isObjectType() ||
> + T->getAsPointerType()->getPointeeType()->isFunctionType()))
> ||
> // -- reference to object or reference to function,
> T->isReferenceType() ||
> // -- pointer to member.
> @@ -1329,7 +1329,7 @@
> const TagType *Tag = 0;
> if (const EnumType *EnumT = Arg->getAsEnumType())
> Tag = EnumT;
> - else if (const RecordType *RecordT = Arg->getAs<RecordType>())
> + else if (const RecordType *RecordT = Arg->getAsRecordType())
> Tag = RecordT;
> if (Tag && Tag->getDecl()->getDeclContext()->isFunctionOrMethod())
> return Diag(ArgLoc, diag::err_template_arg_local_type)
> @@ -1648,13 +1648,13 @@
> // function is selected from the set (13.4).
> // In C++0x, any std::nullptr_t value can be converted.
> (ParamType->isPointerType() &&
> - ParamType->getAs<PointerType>()->getPointeeType()-
> >isFunctionType()) ||
> + ParamType->getAsPointerType()->getPointeeType()-
> >isFunctionType()) ||
> // -- For a non-type template-parameter of type reference to
> // function, no conversions apply. If the template-argument
> // represents a set of overloaded functions, the matching
> // function is selected from the set (13.4).
> (ParamType->isReferenceType() &&
> - ParamType->getAs<ReferenceType>()->getPointeeType()-
> >isFunctionType()) ||
> + ParamType->getAsReferenceType()->getPointeeType()-
> >isFunctionType()) ||
> // -- For a non-type template-parameter of type pointer to
> // member function, no conversions apply. If the
> // template-argument represents a set of overloaded member
> @@ -1662,7 +1662,7 @@
> // the set (13.4).
> // Again, C++0x allows a std::nullptr_t value.
> (ParamType->isMemberPointerType() &&
> - ParamType->getAs<MemberPointerType>()->getPointeeType()
> + ParamType->getAsMemberPointerType()->getPointeeType()
> ->isFunctionType())) {
> if (Context.hasSameUnqualifiedType(ArgType,
>
> ParamType.getNonReferenceType())) {
> @@ -1721,7 +1721,7 @@
> // object, qualification conversions (4.4) and the
> // array-to-pointer conversion (4.2) are applied.
> // C++0x also allows a value of std::nullptr_t.
> - assert(ParamType->getAs<PointerType>()->getPointeeType()-
> >isObjectType() &&
> + assert(ParamType->getAsPointerType()->getPointeeType()-
> >isObjectType() &&
> "Only object pointers allowed here");
>
> if (ArgType->isNullPtrType()) {
> @@ -1755,7 +1755,7 @@
> return false;
> }
>
> - if (const ReferenceType *ParamRefType = ParamType-
> >getAs<ReferenceType>()) {
> + if (const ReferenceType *ParamRefType = ParamType-
> >getAsReferenceType()) {
> // -- For a non-type template-parameter of type reference to
> // object, no conversions apply. The type referred to by the
> // reference may be more cv-qualified than the (otherwise
>
> Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Fri Jul 17 12:50:17
> 2009
> @@ -397,7 +397,7 @@
>
> // T *
> case Type::Pointer: {
> - const PointerType *PointerArg = Arg->getAs<PointerType>();
> + const PointerType *PointerArg = Arg->getAsPointerType();
> if (!PointerArg)
> return Sema::TDK_NonDeducedMismatch;
>
> @@ -410,7 +410,7 @@
>
> // T &
> case Type::LValueReference: {
> - const LValueReferenceType *ReferenceArg = Arg-
> >getAs<LValueReferenceType>();
> + const LValueReferenceType *ReferenceArg = Arg-
> >getAsLValueReferenceType();
> if (!ReferenceArg)
> return Sema::TDK_NonDeducedMismatch;
>
> @@ -422,7 +422,7 @@
>
> // T && [C++0x]
> case Type::RValueReference: {
> - const RValueReferenceType *ReferenceArg = Arg-
> >getAs<RValueReferenceType>();
> + const RValueReferenceType *ReferenceArg = Arg-
> >getAsRValueReferenceType();
> if (!ReferenceArg)
> return Sema::TDK_NonDeducedMismatch;
>
> @@ -615,7 +615,7 @@
> Base != BaseEnd; ++Base) {
> assert(Base->getType()->isRecordType() &&
> "Base class that isn't a record?");
> - ToVisit.push_back(Base->getType()-
> >getAs<RecordType>());
> + ToVisit.push_back(Base->getType()->getAsRecordType());
> }
> }
>
> @@ -1282,7 +1282,7 @@
> // are ignored for type deduction.
> if (CanonParamType.getCVRQualifiers())
> ParamType = CanonParamType.getUnqualifiedType();
> - if (const ReferenceType *ParamRefType = ParamType-
> >getAs<ReferenceType>()) {
> + if (const ReferenceType *ParamRefType = ParamType-
> >getAsReferenceType()) {
> // [...] If P is a reference type, the type referred to by P
> is used
> // for type deduction.
> ParamType = ParamRefType->getPointeeType();
> @@ -1320,7 +1320,7 @@
> if (isSimpleTemplateIdType(ParamType) ||
> (isa<PointerType>(ParamType) &&
> isSimpleTemplateIdType(
> - ParamType->getAs<PointerType>()-
> >getPointeeType())))
> + ParamType->getAsPointerType()-
> >getPointeeType())))
> TDF |= TDF_DerivedClass;
>
> if (TemplateDeductionResult Result
>
> Modified: cfe/trunk/lib/Sema/SemaType.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=76193&r1=76192&r2=76193&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaType.cpp Fri Jul 17 12:50:17 2009
> @@ -300,8 +300,8 @@
> if (TypeQuals & QualType::Restrict) {
> if (Result->isPointerType() || Result->isReferenceType()) {
> QualType EltTy = Result->isPointerType() ?
> - Result->getAs<PointerType>()->getPointeeType() :
> - Result->getAs<ReferenceType>()->getPointeeType();
> + Result->getAsPointerType()->getPointeeType() :
> + Result->getAsReferenceType()->getPointeeType();
>
> // If we have a pointer or reference, the pointee must have
> an object
> // incomplete type.
> @@ -414,7 +414,7 @@
> QualType Sema::BuildReferenceType(QualType T, bool LValueRef,
> unsigned Quals,
> SourceLocation Loc,
> DeclarationName Entity) {
> if (LValueRef) {
> - if (const RValueReferenceType *R = T-
> >getAs<RValueReferenceType>()) {
> + if (const RValueReferenceType *R = T-
> >getAsRValueReferenceType()) {
> // C++0x [dcl.typedef]p9: If a typedef TD names a type that is a
> // reference to a type T, and attempt to create the type
> "lvalue
> // reference to cv TD" creates the type "lvalue reference to
> T".
> @@ -524,7 +524,7 @@
> return QualType();
> }
>
> - if (const RecordType *EltTy = T->getAs<RecordType>()) {
> + if (const RecordType *EltTy = T->getAsRecordType()) {
> // If the element type is a struct or union that contains a
> variadic
> // array, accept it as a GNU extension: C99 6.7.2.1p2.
> if (EltTy->getDecl()->hasFlexibleArrayMember())
> @@ -1185,10 +1185,10 @@
> // an incomplete type a pointer or reference to an incomplete
> type, other
> // than (cv) void*.
> int kind;
> - if (const PointerType* IT = T->getAs<PointerType>()) {
> + if (const PointerType* IT = T->getAsPointerType()) {
> T = IT->getPointeeType();
> kind = 1;
> - } else if (const ReferenceType* IT = T->getAs<ReferenceType>()) {
> + } else if (const ReferenceType* IT = T->getAsReferenceType()) {
> T = IT->getPointeeType();
> kind = 2;
> } else
> @@ -1205,9 +1205,9 @@
> /// to member to a function with an exception specification. This
> means that
> /// it is invalid to add another level of indirection.
> bool Sema::CheckDistantExceptionSpec(QualType T) {
> - if (const PointerType *PT = T->getAs<PointerType>())
> + if (const PointerType *PT = T->getAsPointerType())
> T = PT->getPointeeType();
> - else if (const MemberPointerType *PT = T-
> >getAs<MemberPointerType>())
> + else if (const MemberPointerType *PT = T->getAsMemberPointerType())
> T = PT->getPointeeType();
> else
> return false;
> @@ -1285,9 +1285,9 @@
> // Take one type from the subset.
> QualType CanonicalSubT = Context.getCanonicalType(*SubI);
> bool SubIsPointer = false;
> - if (const ReferenceType *RefTy = CanonicalSubT-
> >getAs<ReferenceType>())
> + if (const ReferenceType *RefTy = CanonicalSubT-
> >getAsReferenceType())
> CanonicalSubT = RefTy->getPointeeType();
> - if (const PointerType *PtrTy = CanonicalSubT-
> >getAs<PointerType>()) {
> + if (const PointerType *PtrTy = CanonicalSubT-
> >getAsPointerType()) {
> CanonicalSubT = PtrTy->getPointeeType();
> SubIsPointer = true;
> }
> @@ -1305,10 +1305,10 @@
> QualType CanonicalSuperT = Context.getCanonicalType(*SuperI);
> // SubT must be SuperT or derived from it, or pointer or
> reference to
> // such types.
> - if (const ReferenceType *RefTy = CanonicalSuperT-
> >getAs<ReferenceType>())
> + if (const ReferenceType *RefTy = CanonicalSuperT-
> >getAsReferenceType())
> CanonicalSuperT = RefTy->getPointeeType();
> if (SubIsPointer) {
> - if (const PointerType *PtrTy = CanonicalSuperT-
> >getAs<PointerType>())
> + if (const PointerType *PtrTy = CanonicalSuperT-
> >getAsPointerType())
> CanonicalSuperT = PtrTy->getPointeeType();
> else {
> continue;
> @@ -1384,16 +1384,16 @@
> /// be called in a loop that successively "unwraps" pointer and
> /// pointer-to-member types to compare them at each level.
> bool Sema::UnwrapSimilarPointerTypes(QualType& T1, QualType& T2) {
> - const PointerType *T1PtrType = T1->getAs<PointerType>(),
> - *T2PtrType = T2->getAs<PointerType>();
> + const PointerType *T1PtrType = T1->getAsPointerType(),
> + *T2PtrType = T2->getAsPointerType();
> if (T1PtrType && T2PtrType) {
> T1 = T1PtrType->getPointeeType();
> T2 = T2PtrType->getPointeeType();
> return true;
> }
>
> - const MemberPointerType *T1MPType = T1->getAs<MemberPointerType>(),
> - *T2MPType = T2->getAs<MemberPointerType>();
> + const MemberPointerType *T1MPType = T1->getAsMemberPointerType(),
> + *T2MPType = T2->getAsMemberPointerType();
> if (T1MPType && T2MPType &&
> Context.getCanonicalType(T1MPType->getClass()) ==
> Context.getCanonicalType(T2MPType->getClass())) {
> @@ -1567,7 +1567,7 @@
>
> // If we have a class template specialization or a class member of a
> // class template specialization, try to instantiate it.
> - if (const RecordType *Record = T->getAs<RecordType>()) {
> + if (const RecordType *Record = T->getAsRecordType()) {
> if (ClassTemplateSpecializationDecl *ClassTemplateSpec
> = dyn_cast<ClassTemplateSpecializationDecl>(Record-
> >getDecl())) {
> if (ClassTemplateSpec->getSpecializationKind() ==
> TSK_Undeclared) {
> @@ -1603,7 +1603,7 @@
> // If the type was a forward declaration of a class/struct/union
> // type, produce
> const TagType *Tag = 0;
> - if (const RecordType *Record = T->getAs<RecordType>())
> + if (const RecordType *Record = T->getAsRecordType())
> Tag = Record;
> else if (const EnumType *Enum = T->getAsEnumType())
> Tag = Enum;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list