diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-17 17:50:17 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-17 17:50:17 +0000 |
commit | 35366a67baa970c287c714c957cf78a4131cf60d (patch) | |
tree | 053ba730a50f0c434f8e6d6ca89d03d9cdcfc14d /lib/Sema/SemaType.cpp | |
parent | 01bc160ffccc03e4c0583acf82bd7ab80494219a (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 6f28e272c4..8195aba967 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -300,8 +300,8 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS, 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::BuildPointerType(QualType T, unsigned Quals, 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 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, 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 @@ bool Sema::CheckSpecifiedExceptionType(QualType T, const SourceRange &Range) { // 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 @@ bool Sema::CheckSpecifiedExceptionType(QualType T, const SourceRange &Range) { /// 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 @@ bool Sema::CheckExceptionSpecSubset(unsigned DiagID, unsigned NoteID, // 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 @@ bool Sema::CheckExceptionSpecSubset(unsigned DiagID, unsigned NoteID, 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 @@ QualType Sema::ObjCGetTypeForMethodDefinition(DeclPtrTy D) { /// 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 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag, // 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 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag, // 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; |