]> granicus.if.org Git - clang/commitdiff
Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type...
authorTed Kremenek <kremenek@apple.com>
Fri, 17 Jul 2009 01:20:38 +0000 (01:20 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 17 Jul 2009 01:20:38 +0000 (01:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76139 91177308-0d34-0410-b5e6-96231b3b80d8

37 files changed:
include/clang/AST/Type.h
lib/AST/ASTContext.cpp
lib/AST/Decl.cpp
lib/AST/DeclBase.cpp
lib/AST/DeclCXX.cpp
lib/AST/DeclPrinter.cpp
lib/AST/DeclarationName.cpp
lib/AST/Expr.cpp
lib/AST/ExprCXX.cpp
lib/AST/ExprConstant.cpp
lib/AST/InheritViz.cpp
lib/AST/Type.cpp
lib/Analysis/RegionStore.cpp
lib/Analysis/Store.cpp
lib/CodeGen/CGCXX.cpp
lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CGObjCMac.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenTypes.cpp
lib/CodeGen/TargetABIInfo.cpp
lib/Frontend/PCHReader.cpp
lib/Sema/SemaCXXScopeSpec.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaInherit.cpp
lib/Sema/SemaInit.cpp
lib/Sema/SemaLookup.cpp
lib/Sema/SemaNamedCast.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateDeduction.cpp
lib/Sema/SemaType.cpp

index d1bf6929f6f9a2da220fcdf3f5478316011700ef..5099c61819e9356536169202e095dabff726853f 100644 (file)
@@ -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;
index dcb18cb91d7f5f4331484edcd81cb4fd9fc0f976..f37ffddc12f7adcdfcfbf24be60b7a04f8ddd853 100644 (file)
@@ -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 '?'
index 728724f1b3d4da30863c9d9eb9747b45be5e3641..a9f258146e5e27ad1f38024d4b83bb2a4819cdc7 100644 (file)
@@ -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;
 }
 
index 96ba19b9a6b99029751e8eb40e3abf7ebbb2d8f2..2d276614f2279426be17896c43724ef19651422a 100644 (file)
@@ -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();
index 57ac611b2ca24cfc131cf15fa90e0ec66551bcca..f420da14e455dfb0b8be100f9df45df65e636eb9 100644 (file)
@@ -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);
index 55d39e5cc8f6bb1b7f559499beaa3fc14aad38a5..1711a7cf5633b744cfa3d93d8288ae4ab4e37b13 100644 (file)
@@ -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 += "~";
index a17abde7773033cdfeb49f5d00d33f3ca62ff4d2..a55b363a0d4ca464024ac0643525980b465b5bfd 100644 (file)
@@ -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();
index 74928bcd76aa8dcc2047ec94617ab23f8861afaf..63a6d3153c742dbe104b0f7bb2e89e8e5111b75e 100644 (file)
@@ -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;
   }
index 399c30255a8f21b3a8547695f426c915c4dd3438..d5cfef23f8398aa02e15d33dfb0cb078c71e74fe 100644 (file)
@@ -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;
   }
index 9473e4f48c1f780948f486b2d9e9854d1b50e460..d01130372cea414f3c2892149803140ae109c3aa 100644 (file)
@@ -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());
index 1188ba5860b4a8a785578e010115b58febf15df5..3e5dd1a53ff2a9926570d49724fc6c8ad843b9bb 100644 (file)
@@ -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());
index 28c3a8f42a28e6fa28bc35f6dd7bce4bb99a7fce..6114dba1486c8cd7887b3fde3c35efd4d145c469 100644 (file)
@@ -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)) {
index 31623b998375e5328d707b147cec8ba085c3b3d9..f956ecab7fdbacdbda739ba41bd4eaa2bd817423 100644 (file)
@@ -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())
index 9147f93eda2ba55db5c7e69f9dc45a94590ae916..66b99a85a37419018e577f9cb43e4f19ab8c7779 100644 (file)
@@ -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;
index 07f387f83feb3c901edf1c315b6b92f81066136e..9031caf50526347b7c19c4ce060b889b171ca336 100644 (file)
@@ -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;
   
index e4192d66f39a0bf8601e10c057edc16a07e45ad6..58be86d2cbea1cb9353a2035868589415493e7a6 100644 (file)
@@ -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()) {
index 4f1f58fefdab3c8371d1cb28cd766d428855a33d..dea207cc72cae920c4212d85ea4c85416090049a 100644 (file)
@@ -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)
index bb80be961b26b152143e4e1ddfc8431ae3f00754..02516d7608442c6b605d0637dcb29a96f27b9ecf 100644 (file)
@@ -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;
         
-        const RecordType *RT = FQT->getAsRecordType();
+        const RecordType *RT = FQT->getAs<RecordType>();
         BuildAggrIvarRecordLayout(RT, BytePos + FieldOffset,
                                   ForStrongLayout, HasUnion);
                                   
index 842bf8be49b7ec484b2792e6764253c601defc08..250ccce3cd0497174d243659b234be8fbb844bf3 100644 (file)
@@ -380,7 +380,7 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
 /// getCGRecordLayout - Return record layout info.
 const CGRecordLayout *CodeGenFunction::getCGRecordLayout(CodeGenTypes &CGT,
                                                          QualType Ty) {
-  const RecordType *RTy = Ty->getAsRecordType();
+  const RecordType *RTy = Ty->getAs<RecordType>();
   assert (RTy && "Unexpected type. RecordType expected here.");
 
   return CGT.getCGRecordLayout(RTy->getDecl());
index d502d79d2945157841d4294ca9805e6acb4d1371..adc88a026bb979c286b6eef72336a64fcf49399a 100644 (file)
@@ -1251,7 +1251,7 @@ GetAddrOfConstantCFString(const StringLiteral *Literal) {
   }
   
   QualType CFTy = getContext().getCFConstantStringType();
-  RecordDecl *CFRD = CFTy->getAsRecordType()->getDecl();
+  RecordDecl *CFRD = CFTy->getAs<RecordType>()->getDecl();
 
   const llvm::StructType *STy = 
     cast<llvm::StructType>(getTypes().ConvertType(CFTy));
index e97cbbd66c90a2d8747c2b1f96c65cefb936504e..2117e6d5b4e966196dfd42dff3fc0ba905cef7b4 100644 (file)
@@ -142,12 +142,12 @@ const llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T) {
 // and all of the argument types are complete.
 static const TagType *VerifyFuncTypeComplete(const Type* T) {
   const FunctionType *FT = cast<FunctionType>(T);
-  if (const TagType* TT = FT->getResultType()->getAsTagType())
+  if (const TagType* TT = FT->getResultType()->getAs<TagType>())
     if (!TT->getDecl()->isDefinition())
       return TT;
   if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(T))
     for (unsigned i = 0; i < FPT->getNumArgs(); i++)
-      if (const TagType* TT = FPT->getArgType(i)->getAsTagType())
+      if (const TagType* TT = FPT->getArgType(i)->getAs<TagType>())
         if (!TT->getDecl()->isDefinition())
           return TT;
   return 0;
index c3f35453ba7f1649d57b2df8a0e90b55e3027ca4..7063327d3ae335cf53e1f46aba8bf63fd3e20077 100644 (file)
@@ -68,7 +68,7 @@ static bool isEmptyField(ASTContext &Context, const FieldDecl *FD) {
 /// fields. Note that a structure with a flexible array member is not
 /// considered empty.
 static bool isEmptyRecord(ASTContext &Context, QualType T) {
-  const RecordType *RT = T->getAsRecordType();
+  const RecordType *RT = T->getAs<RecordType>();
   if (!RT)
     return 0;
   const RecordDecl *RD = RT->getDecl();
@@ -168,7 +168,7 @@ static bool typeContainsSSEVector(const RecordDecl *RD, ASTContext &Context) {
         Context.getTypeSize(FD->getType()) >= 128)
       return true;
 
-    if (const RecordType* RT = FD->getType()->getAsRecordType())
+    if (const RecordType* RT = FD->getType()->getAs<RecordType>())
       if (typeContainsSSEVector(RT->getDecl(), Context))
         return true;
   }
@@ -272,7 +272,7 @@ bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty,
     return shouldReturnTypeInRegister(AT->getElementType(), Context);
 
   // Otherwise, it must be a record type.
-  const RecordType *RT = Ty->getAsRecordType();
+  const RecordType *RT = Ty->getAs<RecordType>();
   if (!RT) return false;
 
   // Structure types are passed in register if all fields would be
@@ -385,7 +385,7 @@ unsigned X86_32ABIInfo::getIndirectArgumentAlignment(QualType Ty,
                                                      ASTContext &Context) {
   unsigned Align = Context.getTypeAlign(Ty);
   if (Align < 128) return 0;
-  if (const RecordType* RT = Ty->getAsRecordType())
+  if (const RecordType* RT = Ty->getAs<RecordType>())
     if (typeContainsSSEVector(RT->getDecl(), Context))
       return 16;
   return 0;
@@ -704,7 +704,7 @@ void X86_64ABIInfo::classify(QualType Ty,
     if (Hi == Memory)
       Lo = Memory;
     assert((Hi != SSEUp || Lo == SSE) && "Invalid SSEUp array classification.");
-  } else if (const RecordType *RT = Ty->getAsRecordType()) {
+  } else if (const RecordType *RT = Ty->getAs<RecordType>()) {
     uint64_t Size = Context.getTypeSize(Ty);
 
     // AMD64-ABI 3.2.3p2: Rule 1. If the size of an object is larger
index 8c26607b7c646c683274c8381c178af2a53705d2..fef2097773e75688c5c5abc9351d91c9bddee750 100644 (file)
@@ -1543,7 +1543,7 @@ void PCHReader::InitializeContext(ASTContext &Ctx) {
     if (const TypedefType *Typedef = FileType->getAsTypedefType())
       Context->setFILEDecl(Typedef->getDecl());
     else {
-      const TagType *Tag = FileType->getAsTagType();
+      const TagType *Tag = FileType->getAs<TagType>();
       assert(Tag && "Invalid FILE type in PCH file");
       Context->setFILEDecl(Tag->getDecl());
     }
index a14bcd5287cd595027975e4d92e67cce328b29bd..ef8a271fb581e7241d87bce1b714f067388dbcfe 100644 (file)
@@ -46,7 +46,7 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS) {
 
   case NestedNameSpecifier::TypeSpec:
   case NestedNameSpecifier::TypeSpecWithTemplate: {
-    const TagType *Tag = NNS->getAsType()->getAsTagType();
+    const TagType *Tag = NNS->getAsType()->getAs<TagType>();
     assert(Tag && "Non-tag type in nested-name-specifier");
     return Tag->getDecl();
   } break;
@@ -169,7 +169,7 @@ bool Sema::RequireCompleteDeclContext(const CXXScopeSpec &SS) {
   if (TagDecl *Tag = dyn_cast<TagDecl>(DC)) {
     // If we're currently defining this type, then lookup into the
     // type is okay: don't complain that it isn't complete yet.
-    const TagType *TagT = Context.getTypeDeclType(Tag)->getAsTagType();
+    const TagType *TagT = Context.getTypeDeclType(Tag)->getAs<TagType>();
     if (TagT->isBeingDefined())
       return false;
 
index 92afc343f39d3f07500b3f356ba51235522f6fd5..d797c80353cc2fda16228ba31b4a471cbdae9c22 100644 (file)
@@ -1151,7 +1151,7 @@ bool Sema::InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner,
         IdResolver.AddDecl(*F);
       }
     } else if (const RecordType *InnerRecordType
-                 = (*F)->getType()->getAsRecordType()) {
+                 = (*F)->getType()->getAs<RecordType>()) {
       RecordDecl *InnerRecord = InnerRecordType->getDecl();
       if (InnerRecord->isAnonymousStructOrUnion())
         Invalid = Invalid || 
@@ -2814,7 +2814,7 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
       if ((!Var->hasExternalStorage() && !Var->isExternC(Context)) &&
           InitType->isRecordType() && !InitType->isDependentType()) {
         CXXRecordDecl *RD = 
-          cast<CXXRecordDecl>(InitType->getAsRecordType()->getDecl());
+          cast<CXXRecordDecl>(InitType->getAs<RecordType>()->getDecl());
         CXXConstructorDecl *Constructor = 0;
         if (!RequireCompleteType(Var->getLocation(), InitType, 
                                     diag::err_invalid_incomplete_type_use))
@@ -4237,7 +4237,7 @@ void Sema::ActOnFields(Scope* S,
       FD->setInvalidDecl();
       EnclosingDecl->setInvalidDecl();
       continue;
-    } else if (const RecordType *FDTTy = FDTy->getAsRecordType()) {
+    } else if (const RecordType *FDTTy = FDTy->getAs<RecordType>()) {
       if (FDTTy->getDecl()->hasFlexibleArrayMember()) {
         // If this is a member of a union, then entire union becomes "flexible".
         if (Record && Record->isUnion()) {
index 5d05b4c444d39f8110c79265515608811b15310c..ea28796ea9196e1a541020d14ce313ddbf35c7dc 100644 (file)
@@ -137,7 +137,7 @@ static inline bool isCFStringType(QualType T, ASTContext &Ctx) {
   if (!PT)
     return false;
 
-  const RecordType *RT = PT->getPointeeType()->getAsRecordType();
+  const RecordType *RT = PT->getPointeeType()->getAs<RecordType>();
   if (!RT)
     return false;
   
index d533e63c48b096a7f653dfe8d3edef09d229a153..fbc8a90fea3d4d556ed6826421ee59051cebefbc 100644 (file)
@@ -384,7 +384,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
     return 0;
 
   // If the base class is polymorphic, the new one is, too.
-  RecordDecl *BaseDecl = BaseType->getAsRecordType()->getDecl();
+  RecordDecl *BaseDecl = BaseType->getAs<RecordType>()->getDecl();
   assert(BaseDecl && "Record type has no declaration");
   BaseDecl = BaseDecl->getDefinition(Context);
   assert(BaseDecl && "Base type is not incomplete, but has no definition");
@@ -833,7 +833,7 @@ void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl,
     for (CXXRecordDecl::base_class_iterator VBase =
          ClassDecl->vbases_begin(),
          E = ClassDecl->vbases_end(); VBase != E; ++VBase)
-      AllBaseOrMembers.push_back(VBase->getType()->getAsRecordType());
+      AllBaseOrMembers.push_back(VBase->getType()->getAs<RecordType>());
       
     for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
          E = ClassDecl->bases_end(); Base != E; ++Base) {
@@ -841,7 +841,7 @@ void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl,
       // first.
       if (Base->isVirtual())
         continue;
-      AllBaseOrMembers.push_back(Base->getType()->getAsRecordType());
+      AllBaseOrMembers.push_back(Base->getType()->getAs<RecordType>());
     }
     
     for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
@@ -956,7 +956,7 @@ namespace {
     // First, collect the pure virtual methods for the base classes.
     for (CXXRecordDecl::base_class_const_iterator Base = RD->bases_begin(),
          BaseEnd = RD->bases_end(); Base != BaseEnd; ++Base) {
-      if (const RecordType *RT = Base->getType()->getAsRecordType()) {
+      if (const RecordType *RT = Base->getType()->getAs<RecordType>()) {
         const CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(RT->getDecl());
         if (BaseDecl && BaseDecl->isAbstract())
           Collect(BaseDecl, Methods);
@@ -1019,7 +1019,7 @@ bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T,
                                     CurrentRD);
   }
   
-  const RecordType *RT = T->getAsRecordType();
+  const RecordType *RT = T->getAs<RecordType>();
   if (!RT)
     return false;
   
@@ -1150,7 +1150,7 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
       while (const ArrayType *AT = Context.getAsArrayType(FTy))
         FTy = AT->getElementType();
       
-      if (const RecordType *RT = FTy->getAsRecordType()) {
+      if (const RecordType *RT = FTy->getAs<RecordType>()) {
         CXXRecordDecl *FieldRD = cast<CXXRecordDecl>(RT->getDecl());
         
         if (!FieldRD->hasTrivialConstructor())
@@ -1224,7 +1224,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
     for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
          HasConstCopyConstructor && Base != ClassDecl->bases_end(); ++Base) {
       const CXXRecordDecl *BaseClassDecl
-        = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
+        = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
       HasConstCopyConstructor 
         = BaseClassDecl->hasConstCopyConstructor(Context);
     }
@@ -1239,7 +1239,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
       QualType FieldType = (*Field)->getType();
       if (const ArrayType *Array = Context.getAsArrayType(FieldType))
         FieldType = Array->getElementType();
-      if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
+      if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
         const CXXRecordDecl *FieldClassDecl 
           = cast<CXXRecordDecl>(FieldClassType->getDecl());
         HasConstCopyConstructor 
@@ -1304,7 +1304,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
     for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
          HasConstCopyAssignment && Base != ClassDecl->bases_end(); ++Base) {
       const CXXRecordDecl *BaseClassDecl
-        = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
+        = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
       HasConstCopyAssignment = BaseClassDecl->hasConstCopyAssignment(Context);
     }
 
@@ -1318,7 +1318,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
       QualType FieldType = (*Field)->getType();
       if (const ArrayType *Array = Context.getAsArrayType(FieldType))
         FieldType = Array->getElementType();
-      if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
+      if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
         const CXXRecordDecl *FieldClassDecl
           = cast<CXXRecordDecl>(FieldClassType->getDecl());
         HasConstCopyAssignment
@@ -2041,7 +2041,7 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
   for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
        E = ClassDecl->bases_end(); Base != E; ++Base) {
     CXXRecordDecl *BaseClassDecl
-      = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
+      = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
     if (!BaseClassDecl->hasTrivialConstructor()) {
       if (CXXConstructorDecl *BaseCtor = 
             BaseClassDecl->getDefaultConstructor(Context))
@@ -2061,7 +2061,7 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
     QualType FieldType = Context.getCanonicalType((*Field)->getType());
     if (const ArrayType *Array = Context.getAsArrayType(FieldType))
       FieldType = Array->getElementType();
-    if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
+    if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
       if (!FieldClassDecl->hasTrivialConstructor()) {
@@ -2113,7 +2113,7 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
   for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
        E = ClassDecl->bases_end(); Base != E; ++Base) {
     CXXRecordDecl *BaseClassDecl
-      = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
+      = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
     if (!BaseClassDecl->hasTrivialDestructor()) {
       if (CXXDestructorDecl *BaseDtor = 
           const_cast<CXXDestructorDecl*>(BaseClassDecl->getDestructor(Context)))
@@ -2129,7 +2129,7 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
     QualType FieldType = Context.getCanonicalType((*Field)->getType());
     if (const ArrayType *Array = Context.getAsArrayType(FieldType))
       FieldType = Array->getElementType();
-    if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
+    if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
       if (!FieldClassDecl->hasTrivialDestructor()) {
@@ -2165,7 +2165,7 @@ void Sema::DefineImplicitOverloadedAssign(SourceLocation CurrentLocation,
   for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
        E = ClassDecl->bases_end(); Base != E; ++Base) {
     CXXRecordDecl *BaseClassDecl
-      = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
+      = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
     if (CXXMethodDecl *BaseAssignOpMethod = 
           getAssignOperatorMethod(MethodDecl->getParamDecl(0), BaseClassDecl))
       MarkDeclarationReferenced(CurrentLocation, BaseAssignOpMethod);
@@ -2175,7 +2175,7 @@ void Sema::DefineImplicitOverloadedAssign(SourceLocation CurrentLocation,
     QualType FieldType = Context.getCanonicalType((*Field)->getType());
     if (const ArrayType *Array = Context.getAsArrayType(FieldType))
       FieldType = Array->getElementType();
-    if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
+    if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
       if (CXXMethodDecl *FieldAssignOpMethod = 
@@ -2251,7 +2251,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
   for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
        Base != ClassDecl->bases_end(); ++Base) {
     CXXRecordDecl *BaseClassDecl
-      = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
+      = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
     if (CXXConstructorDecl *BaseCopyCtor = 
         BaseClassDecl->getCopyConstructor(Context, TypeQuals))
       MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor);
@@ -2262,7 +2262,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
     QualType FieldType = Context.getCanonicalType((*Field)->getType());
     if (const ArrayType *Array = Context.getAsArrayType(FieldType))
       FieldType = Array->getElementType();
-    if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
+    if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
       if (CXXConstructorDecl *FieldCopyCtor = 
@@ -2286,7 +2286,7 @@ void Sema::InitializeVarWithConstructor(VarDecl *VD,
 void Sema::MarkDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
 {
   CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(
-                                  DeclInitType->getAsRecordType()->getDecl());
+                                  DeclInitType->getAs<RecordType>()->getDecl());
   if (!ClassDecl->hasTrivialDestructor())
     if (CXXDestructorDecl *Destructor = 
         const_cast<CXXDestructorDecl*>(ClassDecl->getDestructor(Context)))
@@ -2402,7 +2402,7 @@ Sema::PerformInitializationByConstructor(QualType ClassType,
                                          SourceLocation Loc, SourceRange Range,
                                          DeclarationName InitEntity,
                                          InitializationKind Kind) {
-  const RecordType *ClassRec = ClassType->getAsRecordType();
+  const RecordType *ClassRec = ClassType->getAs<RecordType>();
   assert(ClassRec && "Can only initialize a class type here");
 
   // C++ [dcl.init]p14: 
@@ -2652,7 +2652,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
   if (!isRValRef && !SuppressUserConversions && T2->isRecordType()) {
     // FIXME: Look for conversions in base classes!
     CXXRecordDecl *T2RecordDecl 
-      = dyn_cast<CXXRecordDecl>(T2->getAsRecordType()->getDecl());
+      = dyn_cast<CXXRecordDecl>(T2->getAs<RecordType>()->getDecl());
 
     OverloadCandidateSet CandidateSet;
     OverloadedFunctionDecl *Conversions 
index da5e6bad03413be20d0c3855166cb36797ea2ea3..ff5ead0694ae935362476e16e1d8640a1072133a 100644 (file)
@@ -2133,7 +2133,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
 
   // Handle field access to simple records.  This also handles access to fields
   // of the ObjC 'id' struct.
-  if (const RecordType *RTy = BaseType->getAsRecordType()) {
+  if (const RecordType *RTy = BaseType->getAs<RecordType>()) {
     RecordDecl *RDecl = RTy->getDecl();
     if (RequireCompleteType(OpLoc, BaseType,
                                diag::err_typecheck_incomplete_tag,
@@ -2937,7 +2937,7 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr) {
         << castType << castExpr->getSourceRange();
     } else if (castType->isUnionType()) {
       // GCC cast to union extension
-      RecordDecl *RD = castType->getAsRecordType()->getDecl();
+      RecordDecl *RD = castType->getAs<RecordType>()->getDecl();
       RecordDecl::field_iterator Field, FieldEnd;
       for (Field = RD->field_begin(), FieldEnd = RD->field_end();
            Field != FieldEnd; ++Field) {
@@ -3078,8 +3078,8 @@ QualType Sema::CheckConditionalOperands(Expr *&Cond, Expr *&LHS, Expr *&RHS,
 
   // If both operands are the same structure or union type, the result is that
   // type.
-  if (const RecordType *LHSRT = LHSTy->getAsRecordType()) {    // C99 6.5.15p3
-    if (const RecordType *RHSRT = RHSTy->getAsRecordType())
+  if (const RecordType *LHSRT = LHSTy->getAs<RecordType>()) {    // C99 6.5.15p3
+    if (const RecordType *RHSRT = RHSTy->getAs<RecordType>())
       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.
@@ -5256,7 +5256,7 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
         continue;
       }
 
-      const RecordType *RC = Res->getType()->getAsRecordType();
+      const RecordType *RC = Res->getType()->getAs<RecordType>();
       if (!RC) {
         Res->Destroy(Context);
         return ExprError(Diag(OC.LocEnd, diag::err_offsetof_record_type)
index b3de60ad8a5381ba90492bc3705b6744b75fddad..8b7baff972c876a465cfadb1d2f1b32b949e6895 100644 (file)
@@ -83,7 +83,7 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
     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->getAsRecordType()) {
+      if (const RecordType *RecordT = T->getAs<RecordType>()) {
         CXXRecordDecl *RecordD = cast<CXXRecordDecl>(RecordT->getDecl());
         if (RecordD->isPolymorphic())
           isUnevaluatedOperand = false;
@@ -211,7 +211,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, TypeTy *TypeRep,
                                                      RParenLoc));
   }
 
-  if (const RecordType *RT = Ty->getAsRecordType()) {
+  if (const RecordType *RT = Ty->getAs<RecordType>()) {
     CXXRecordDecl *Record = cast<CXXRecordDecl>(RT->getDecl());
 
     // FIXME: We should always create a CXXTemporaryObjectExpr here unless
@@ -414,7 +414,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
   if (AllocType->isDependentType()) {
     // Skip all the checks.
   }
-  else if ((RT = AllocType->getAsRecordType()) &&
+  else if ((RT = AllocType->getAs<RecordType>()) &&
             !AllocType->isAggregateType()) {
     Constructor = PerformInitializationByConstructor(
                       AllocType, ConsArgs, NumConsArgs,
@@ -516,7 +516,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
                                         IsArray ? OO_Array_New : OO_New);
   if (AllocType->isRecordType() && !UseGlobal) {
     CXXRecordDecl *Record 
-      = cast<CXXRecordDecl>(AllocType->getAsRecordType()->getDecl());
+      = cast<CXXRecordDecl>(AllocType->getAs<RecordType>()->getDecl());
     // FIXME: We fail to find inherited overloads.
     if (FindAllocationOverload(StartLoc, Range, NewName, &AllocArgs[0],
                           AllocArgs.size(), Record, /*AllowMissing=*/true,
@@ -757,7 +757,7 @@ Sema::ActOnCXXConditionDeclarationExpr(Scope *S, SourceLocation StartLoc,
   } 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->getAsRecordType()) {
+  } else if (const RecordType *RT = Ty->getAs<RecordType>()) {
     RecordDecl *RD = RT->getDecl();
     // The type-specifier-seq shall not declare a new class...
     if (RD->isDefinition() &&
@@ -1051,7 +1051,7 @@ QualType Sema::CheckPointerToMemberOperands(
   //   be of type "pointer to member of T" (where T is a completely-defined
   //   class type) [...]
   QualType RType = rex->getType();
-  const MemberPointerType *MemPtr = RType->getAsMemberPointerType();
+  const MemberPointerType *MemPtr = RType->getAs<MemberPointerType>();
   if (!MemPtr) {
     Diag(Loc, diag::err_bad_memptr_rhs)
       << OpSpelling << RType << rex->getSourceRange();
@@ -1163,8 +1163,8 @@ static bool TryClassUnification(Sema &Self, Expr *From, Expr *To,
   //         the same or one is a base class of the other:
   QualType FTy = From->getType();
   QualType TTy = To->getType();
-  const RecordType *FRec = FTy->getAsRecordType();
-  const RecordType *TRec = TTy->getAsRecordType();
+  const RecordType *FRec = FTy->getAs<RecordType>();
+  const RecordType *TRec = TTy->getAs<RecordType>();
   bool FDerivedFromT = FRec && TRec && Self.IsDerivedFrom(FTy, TTy);
   if (FRec && TRec && (FRec == TRec ||
         FDerivedFromT || Self.IsDerivedFrom(TTy, FTy))) {
@@ -1418,8 +1418,8 @@ QualType Sema::CXXCheckConditionalOperands(Expr *&Cond, Expr *&LHS, Expr *&RHS,
   // 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->getAsMemberPointerType();
-  const MemberPointerType *RMemPtr = RTy->getAsMemberPointerType();
+  const MemberPointerType *LMemPtr = LTy->getAs<MemberPointerType>();
+  const MemberPointerType *RMemPtr = RTy->getAs<MemberPointerType>();
   if (LMemPtr && RHS->isNullPointerConstant(Context)) {
     ImpCastExprToType(RHS, LTy);
     return LTy;
@@ -1562,7 +1562,7 @@ QualType Sema::FindCompositePointerType(Expr *&E1, Expr *&E2) {
 }
 
 Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
-  const RecordType *RT = E->getType()->getAsRecordType();
+  const RecordType *RT = E->getType()->getAs<RecordType>();
   if (!RT)
     return Owned(E);
   
index 2f914f14a81fa488e6b3bf7f4e9e5d7c2b48a92a..be235e927158a724205faad787038c3d129ed016 100644 (file)
@@ -114,7 +114,7 @@ bool Sema::IsDerivedFrom(QualType Derived, QualType Base, BasePaths &Paths) {
     return false;
 
   Paths.setOrigin(Derived);
-  return LookupInBases(cast<CXXRecordDecl>(Derived->getAsRecordType()->getDecl()),
+  return LookupInBases(cast<CXXRecordDecl>(Derived->getAs<RecordType>()->getDecl()),
                        MemberLookupCriteria(Base), Paths);
 }
 
@@ -156,7 +156,7 @@ bool Sema::LookupInBases(CXXRecordDecl *Class,
       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->getAsRecordType();
+        Paths.DetectedVirtual = BaseType->getAs<RecordType>();
         SetVirtual = true;
       }
     } else
@@ -175,7 +175,7 @@ bool Sema::LookupInBases(CXXRecordDecl *Class,
     }
 
     CXXRecordDecl *BaseRecord 
-      = cast<CXXRecordDecl>(BaseSpec->getType()->getAsRecordType()->getDecl());
+      = cast<CXXRecordDecl>(BaseSpec->getType()->getAs<RecordType>()->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
index 52099a3d904f15070311d8331d1aa506268a4c94..d92f37fb25609d6f003035a9de8a4da3258f160d 100644 (file)
@@ -162,7 +162,7 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
       if ((DeclTypeC.getUnqualifiedType() == InitTypeC.getUnqualifiedType()) ||
           IsDerivedFrom(InitTypeC, DeclTypeC)) {
         const CXXRecordDecl *RD = 
-          cast<CXXRecordDecl>(DeclType->getAsRecordType()->getDecl());
+          cast<CXXRecordDecl>(DeclType->getAs<RecordType>()->getDecl());
         
         // No need to make a CXXConstructExpr if both the ctor and dtor are
         // trivial.
@@ -341,7 +341,7 @@ void InitListChecker::FillInValueInitializations(InitListExpr *ILE) {
   if (ILE->getSyntacticForm())
     Loc = ILE->getSyntacticForm()->getSourceRange().getBegin();
   
-  if (const RecordType *RType = ILE->getType()->getAsRecordType()) {
+  if (const RecordType *RType = ILE->getType()->getAs<RecordType>()) {
     unsigned Init = 0, NumInits = ILE->getNumInits();
     for (RecordDecl::field_iterator 
            Field = RType->getDecl()->field_begin(),
@@ -447,7 +447,7 @@ int InitListChecker::numArrayElements(QualType DeclType) {
 }
 
 int InitListChecker::numStructUnionElements(QualType DeclType) {
-  RecordDecl *structDecl = DeclType->getAsRecordType()->getDecl();
+  RecordDecl *structDecl = DeclType->getAs<RecordType>()->getDecl();
   int InitializableMembers = 0;
   for (RecordDecl::field_iterator 
          Field = structDecl->field_begin(),
@@ -584,7 +584,7 @@ void InitListChecker::CheckListElementTypes(InitListExpr *IList,
     CheckVectorType(IList, DeclType, Index, StructuredList, StructuredIndex);
   } else if (DeclType->isAggregateType()) {
     if (DeclType->isRecordType()) {
-      RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
+      RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
       CheckStructUnionTypes(IList, DeclType, RD->field_begin(), 
                             SubobjectIsDesignatorContext, Index,
                             StructuredList, StructuredIndex,
@@ -939,7 +939,7 @@ void InitListChecker::CheckStructUnionTypes(InitListExpr *IList,
                                             InitListExpr *StructuredList,
                                             unsigned &StructuredIndex,
                                             bool TopLevelObject) {
-  RecordDecl* structDecl = DeclType->getAsRecordType()->getDecl();
+  RecordDecl* structDecl = DeclType->getAs<RecordType>()->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 @@ void InitListChecker::CheckStructUnionTypes(InitListExpr *IList,
 
   if (DeclType->isUnionType() && IList->getNumInits() == 0) {
     // Value-initialize the first named member of the union.
-    RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
+    RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
     for (RecordDecl::field_iterator FieldEnd = RD->field_end();
          Field != FieldEnd; ++Field) {
       if (Field->getDeclName()) {
@@ -965,7 +965,7 @@ void InitListChecker::CheckStructUnionTypes(InitListExpr *IList,
   // 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->getAsRecordType()->getDecl();
+  RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
   RecordDecl::field_iterator FieldEnd = RD->field_end();
   bool InitializedSomething = false;
   while (Index < IList->getNumInits()) {
@@ -1204,7 +1204,7 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList,
     //   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->getAsRecordType();
+    const RecordType *RT = CurrentObjectType->getAs<RecordType>();
     if (!RT) {
       SourceLocation Loc = D->getDotLoc();
       if (Loc.isInvalid())
@@ -1564,7 +1564,7 @@ InitListChecker::getStructuredSubobjectInit(InitListExpr *IList, unsigned Index,
     }
   } else if (const VectorType *VType = CurrentObjectType->getAsVectorType())
     NumElements = VType->getNumElements();
-  else if (const RecordType *RType = CurrentObjectType->getAsRecordType()) {
+  else if (const RecordType *RType = CurrentObjectType->getAs<RecordType>()) {
     RecordDecl *RDecl = RType->getDecl();
     if (RDecl->isUnion())
       NumElements = 1;
@@ -1758,7 +1758,7 @@ bool Sema::CheckValueInitialization(QualType Type, SourceLocation Loc) {
   if (const ArrayType *AT = Context.getAsArrayType(Type))
     return CheckValueInitialization(AT->getElementType(), Loc);
 
-  if (const RecordType *RT = Type->getAsRecordType()) {
+  if (const RecordType *RT = Type->getAs<RecordType>()) {
     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
index a37be6898f31c2373db3dad502c6e1b5e969cc44..1ca3412620369bad242d70d277fd696d36810586 100644 (file)
@@ -1387,7 +1387,7 @@ addAssociatedClassesAndNamespaces(CXXRecordDecl *Class,
     for (CXXRecordDecl::base_class_iterator Base = Class->bases_begin(),
                                          BaseEnd = Class->bases_end();
          Base != BaseEnd; ++Base) {
-      const RecordType *BaseType = Base->getType()->getAsRecordType();
+      const RecordType *BaseType = Base->getType()->getAs<RecordType>();
       CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(BaseType->getDecl());
       if (AssociatedClasses.insert(BaseDecl)) {
         // Find the associated namespace for this base class.
@@ -1453,7 +1453,7 @@ addAssociatedClassesAndNamespaces(QualType T,
   //        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->getAsRecordType())
+  if (const RecordType *ClassType = T->getAs<RecordType>())
     if (CXXRecordDecl *ClassDecl 
         = dyn_cast<CXXRecordDecl>(ClassType->getDecl())) {
       addAssociatedClassesAndNamespaces(ClassDecl, Context, 
@@ -1519,7 +1519,7 @@ addAssociatedClassesAndNamespaces(QualType T,
   //        associated namespaces and classes are those associated
   //        with the member type together with those associated with
   //        X. 
-  if (const MemberPointerType *MemberPtr = T->getAsMemberPointerType()) {
+  if (const MemberPointerType *MemberPtr = T->getAs<MemberPointerType>()) {
     // Handle the type that the pointer to member points to.
     addAssociatedClassesAndNamespaces(MemberPtr->getPointeeType(),
                                       Context,
@@ -1527,7 +1527,7 @@ addAssociatedClassesAndNamespaces(QualType T,
                                       GlobalScope);
 
     // Handle the class type into which this points.
-    if (const RecordType *Class = MemberPtr->getClass()->getAsRecordType())
+    if (const RecordType *Class = MemberPtr->getClass()->getAs<RecordType>())
       addAssociatedClassesAndNamespaces(cast<CXXRecordDecl>(Class->getDecl()),
                                         Context,
                                         AssociatedNamespaces, AssociatedClasses,
index 1fdbcfe6a13ce621c1b53fa67faeacdee8d77986..0dedd3a4bc73ba06fcc176476237145782c3c0a5 100644 (file)
@@ -118,7 +118,7 @@ CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
   DestType = Self.Context.getCanonicalType(DestType);
   QualType SrcType = SrcExpr->getType();
   if (const LValueReferenceType *DestTypeTmp =
-        DestType->getAsLValueReferenceType()) {
+        DestType->getAs<LValueReferenceType>()) {
     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 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
   DestType = Self.Context.getCanonicalType(DestType);
   QualType SrcType = SrcExpr->getType();
   if (const LValueReferenceType *DestTypeTmp =
-        DestType->getAsLValueReferenceType()) {
+        DestType->getAs<LValueReferenceType>()) {
     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 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
     DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
     SrcType = Self.Context.getPointerType(SrcType);
   } else if (const RValueReferenceType *DestTypeTmp =
-               DestType->getAsRValueReferenceType()) {
+               DestType->getAs<RValueReferenceType>()) {
     // Both the reference conversion and the rvalue rules apply.
     Self.DefaultFunctionArrayConversion(SrcExpr);
     SrcType = SrcExpr->getType();
@@ -253,8 +253,8 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
   // Canonicalize source for comparison.
   SrcType = Self.Context.getCanonicalType(SrcType);
 
-  const MemberPointerType *DestMemPtr = DestType->getAsMemberPointerType(),
-                          *SrcMemPtr = SrcType->getAsMemberPointerType();
+  const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>(),
+                          *SrcMemPtr = SrcType->getAs<MemberPointerType>();
   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
@@ -563,7 +563,7 @@ TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType,
 {
   // 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->getAsRValueReferenceType();
+  const RValueReferenceType *R = DestType->getAs<RValueReferenceType>();
   if (!R)
     return TSC_NotApplicable;
 
@@ -738,10 +738,10 @@ TryStaticCastResult
 TryStaticMemberPointerUpcast(Sema &Self, QualType SrcType, QualType DestType,
                              const SourceRange &OpRange)
 {
-  const MemberPointerType *SrcMemPtr = SrcType->getAsMemberPointerType();
+  const MemberPointerType *SrcMemPtr = SrcType->getAs<MemberPointerType>();
   if (!SrcMemPtr)
     return TSC_NotApplicable;
-  const MemberPointerType *DestMemPtr = DestType->getAsMemberPointerType();
+  const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>();
   if (!DestMemPtr)
     return TSC_NotApplicable;
 
@@ -840,7 +840,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
     return;
   }
 
-  const RecordType *DestRecord = DestPointee->getAsRecordType();
+  const RecordType *DestRecord = DestPointee->getAs<RecordType>();
   if (DestPointee->isVoidType()) {
     assert(DestPointer && "Reference to void is not possible");
   } else if (DestRecord) {
@@ -880,7 +880,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
     SrcPointee = SrcType;
   }
 
-  const RecordType *SrcRecord = SrcPointee->getAsRecordType();
+  const RecordType *SrcRecord = SrcPointee->getAs<RecordType>();
   if (SrcRecord) {
     if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee,
                                     diag::err_bad_dynamic_cast_incomplete,
index aef7f181e514353f072477560525c1300d550e37..0a161578f8e6da35175ae90417c5e5d34c7b40b3 100644 (file)
@@ -1178,7 +1178,7 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType) {
 bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
                                      QualType ToType, QualType &ConvertedType)
 {
-  const MemberPointerType *ToTypePtr = ToType->getAsMemberPointerType();
+  const MemberPointerType *ToTypePtr = ToType->getAs<MemberPointerType>();
   if (!ToTypePtr)
     return false;
 
@@ -1189,7 +1189,7 @@ bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
   }
 
   // Otherwise, both types have to be member pointers.
-  const MemberPointerType *FromTypePtr = FromType->getAsMemberPointerType();
+  const MemberPointerType *FromTypePtr = FromType->getAs<MemberPointerType>();
   if (!FromTypePtr)
     return false;
 
@@ -1216,11 +1216,11 @@ bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
 /// otherwise.
 bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType) {
   QualType FromType = From->getType();
-  const MemberPointerType *FromPtrType = FromType->getAsMemberPointerType();
+  const MemberPointerType *FromPtrType = FromType->getAs<MemberPointerType>();
   if (!FromPtrType)
     return false;
 
-  const MemberPointerType *ToPtrType = ToType->getAsMemberPointerType();
+  const MemberPointerType *ToPtrType = ToType->getAs<MemberPointerType>();
   assert(ToPtrType && "No member pointer cast has a target type "
                       "that is not a member pointer.");
 
@@ -1340,7 +1340,7 @@ bool Sema::IsUserDefinedConversion(Expr *From, QualType ToType,
                                    bool AllowExplicit, bool ForceRValue)
 {
   OverloadCandidateSet CandidateSet;
-  if (const RecordType *ToRecordType = ToType->getAsRecordType()) {
+  if (const RecordType *ToRecordType = ToType->getAs<RecordType>()) {
     if (CXXRecordDecl *ToRecordDecl 
           = dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) {
       // C++ [over.match.ctor]p1:
@@ -1369,7 +1369,7 @@ bool Sema::IsUserDefinedConversion(Expr *From, QualType ToType,
   if (!AllowConversionFunctions) {
     // Don't allow any conversion functions to enter the overload set.
   } else if (const RecordType *FromRecordType 
-               = From->getType()->getAsRecordType()) {
+               = From->getType()->getAs<RecordType>()) {
     if (CXXRecordDecl *FromRecordDecl 
           = dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
       // Add all of the conversion functions as candidates.
@@ -2500,7 +2500,7 @@ void Sema::AddMemberOperatorCandidates(OverloadedOperatorKind Op,
   //        (13.3.1.1.1); otherwise, the set of member candidates is
   //        empty.
   // FIXME: Lookup in base classes, too!
-  if (const RecordType *T1Rec = T1->getAsRecordType()) {
+  if (const RecordType *T1Rec = T1->getAs<RecordType>()) {
     DeclContext::lookup_const_iterator Oper, OperEnd;
     for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(OpName);
          Oper != OperEnd; ++Oper)
@@ -2668,7 +2668,7 @@ BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants(
   if (!MemberPointerTypes.insert(Ty))
     return false;
 
-  if (const MemberPointerType *PointerTy = Ty->getAsMemberPointerType()) {
+  if (const MemberPointerType *PointerTy = Ty->getAs<MemberPointerType>()) {
     QualType PointeeTy = PointerTy->getPointeeType();
     const Type *ClassTy = PointerTy->getClass();
     // FIXME: Optimize this so that we don't keep trying to add the same types.
@@ -2728,7 +2728,7 @@ BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
     // 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->getAsRecordType()) {
+    if (const RecordType *PointeeRec = PointeeTy->getAs<RecordType>()) {
       CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(PointeeRec->getDecl());
       for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
            Base != ClassDecl->bases_end(); ++Base) {
@@ -2747,7 +2747,7 @@ BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
   } else if (Ty->isEnumeralType()) {
     EnumerationTypes.insert(Ty);
   } else if (AllowUserConversions) {
-    if (const RecordType *TyRec = Ty->getAsRecordType()) {
+    if (const RecordType *TyRec = Ty->getAs<RecordType>()) {
       CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(TyRec->getDecl());
       // FIXME: Visit conversion functions in the base classes, too.
       OverloadedFunctionDecl *Conversions 
@@ -3616,11 +3616,11 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
         bool isRValueReference = false;
         bool isPointer = false;
         if (const LValueReferenceType *FnTypeRef =
-              FnType->getAsLValueReferenceType()) {
+              FnType->getAs<LValueReferenceType>()) {
           FnType = FnTypeRef->getPointeeType();
           isLValueReference = true;
         } else if (const RValueReferenceType *FnTypeRef =
-                     FnType->getAsRValueReferenceType()) {
+                     FnType->getAs<RValueReferenceType>()) {
           FnType = FnTypeRef->getPointeeType();
           isRValueReference = true;
         }
@@ -3678,7 +3678,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
   else if (const ReferenceType *ToTypeRef = ToType->getAs<ReferenceType>())
     FunctionType = ToTypeRef->getPointeeType();
   else if (const MemberPointerType *MemTypePtr =
-                    ToType->getAsMemberPointerType()) {
+                    ToType->getAs<MemberPointerType>()) {
     FunctionType = MemTypePtr->getPointeeType();
     IsMember = true;
   }
@@ -4367,7 +4367,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
                                    SourceLocation *CommaLocs, 
                                    SourceLocation RParenLoc) {
   assert(Object->getType()->isRecordType() && "Requires object type argument");
-  const RecordType *Record = Object->getType()->getAsRecordType();
+  const RecordType *Record = Object->getType()->getAs<RecordType>();
   
   // C++ [over.call.object]p1:
   //  If the primary-expression E in the function call syntax
@@ -4579,7 +4579,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc,
   // FIXME: look in base classes.
   DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Arrow);
   OverloadCandidateSet CandidateSet;
-  const RecordType *BaseRecord = Base->getType()->getAsRecordType();
+  const RecordType *BaseRecord = Base->getType()->getAs<RecordType>();
   
   DeclContext::lookup_const_iterator Oper, OperEnd;
   for (llvm::tie(Oper, OperEnd) 
index 9159cf12d5d5feb35575eab1f7bf149716967e78..9ee4f3fcabd1dae1b8c7b9997d992959365fb5ca 100644 (file)
@@ -1329,7 +1329,7 @@ bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param,
   const TagType *Tag = 0;
   if (const EnumType *EnumT = Arg->getAsEnumType())
     Tag = EnumT;
-  else if (const RecordType *RecordT = Arg->getAsRecordType())
+  else if (const RecordType *RecordT = Arg->getAs<RecordType>())
     Tag = RecordT;
   if (Tag && Tag->getDecl()->getDeclContext()->isFunctionOrMethod())
     return Diag(ArgLoc, diag::err_template_arg_local_type)
@@ -1662,7 +1662,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
       //    the set (13.4).
       // Again, C++0x allows a std::nullptr_t value.
       (ParamType->isMemberPointerType() &&
-       ParamType->getAsMemberPointerType()->getPointeeType()
+       ParamType->getAs<MemberPointerType>()->getPointeeType()
          ->isFunctionType())) {
     if (Context.hasSameUnqualifiedType(ArgType, 
                                        ParamType.getNonReferenceType())) {
index d475538586536870df847ca5e26d77ea8e236d25..5c4f6e796929bf12946b99c7756396a7c42a1de0 100644 (file)
@@ -410,7 +410,7 @@ DeduceTemplateArguments(ASTContext &Context,
       
     //     T &
     case Type::LValueReference: {
-      const LValueReferenceType *ReferenceArg = Arg->getAsLValueReferenceType();
+      const LValueReferenceType *ReferenceArg = Arg->getAs<LValueReferenceType>();
       if (!ReferenceArg)
         return Sema::TDK_NonDeducedMismatch;
       
@@ -422,7 +422,7 @@ DeduceTemplateArguments(ASTContext &Context,
 
     //     T && [C++0x]
     case Type::RValueReference: {
-      const RValueReferenceType *ReferenceArg = Arg->getAsRValueReferenceType();
+      const RValueReferenceType *ReferenceArg = Arg->getAs<RValueReferenceType>();
       if (!ReferenceArg)
         return Sema::TDK_NonDeducedMismatch;
       
@@ -615,7 +615,7 @@ DeduceTemplateArguments(ASTContext &Context,
                Base != BaseEnd; ++Base) {
               assert(Base->getType()->isRecordType() && 
                      "Base class that isn't a record?");
-              ToVisit.push_back(Base->getType()->getAsRecordType());
+              ToVisit.push_back(Base->getType()->getAs<RecordType>());
             }
           }
           
index d69227cc9424b141479cfe00c7b8277cf614dad6..6f28e272c4095cc137a87ae436c588977ce9fc61 100644 (file)
@@ -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->getAsRValueReferenceType()) {
+    if (const RValueReferenceType *R = T->getAs<RValueReferenceType>()) {
       // 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->getAsRecordType()) {
+  if (const RecordType *EltTy = T->getAs<RecordType>()) {
     // 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())
@@ -1207,7 +1207,7 @@ bool Sema::CheckSpecifiedExceptionType(QualType T, const SourceRange &Range) {
 bool Sema::CheckDistantExceptionSpec(QualType T) {
   if (const PointerType *PT = T->getAs<PointerType>())
     T = PT->getPointeeType();
-  else if (const MemberPointerType *PT = T->getAsMemberPointerType())
+  else if (const MemberPointerType *PT = T->getAs<MemberPointerType>())
     T = PT->getPointeeType();
   else
     return false;
@@ -1392,8 +1392,8 @@ bool Sema::UnwrapSimilarPointerTypes(QualType& T1, QualType& T2) {
     return true;
   }
 
-  const MemberPointerType *T1MPType = T1->getAsMemberPointerType(),
-                          *T2MPType = T2->getAsMemberPointerType();
+  const MemberPointerType *T1MPType = T1->getAs<MemberPointerType>(),
+                          *T2MPType = T2->getAs<MemberPointerType>();
   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->getAsRecordType()) {
+  if (const RecordType *Record = T->getAs<RecordType>()) {
     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->getAsRecordType())
+  if (const RecordType *Record = T->getAs<RecordType>())
     Tag = Record;
   else if (const EnumType *Enum = T->getAsEnumType())
     Tag = Enum;