Change uses of:
  Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsRecordType() -> Type::getAs<RecordType>()
  Type::getAsPointerType() -> Type::getAs<PointerType>()
  Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
  Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
  Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
  Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
  Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsTagType() -> Type::getAs<TagType>()
  
And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77510 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 8665705..61be4da 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1535,7 +1535,7 @@
     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());
     }
@@ -1546,7 +1546,7 @@
     if (const TypedefType *Typedef = Jmp_bufType->getAsTypedefType())
       Context->setjmp_bufDecl(Typedef->getDecl());
     else {
-      const TagType *Tag = Jmp_bufType->getAsTagType();
+      const TagType *Tag = Jmp_bufType->getAs<TagType>();
       assert(Tag && "Invalid jmp_bug type in PCH file");
       Context->setjmp_bufDecl(Tag->getDecl());
     }
@@ -1557,7 +1557,7 @@
     if (const TypedefType *Typedef = Sigjmp_bufType->getAsTypedefType())
       Context->setsigjmp_bufDecl(Typedef->getDecl());
     else {
-      const TagType *Tag = Sigjmp_bufType->getAsTagType();
+      const TagType *Tag = Sigjmp_bufType->getAs<TagType>();
       assert(Tag && "Invalid sigjmp_buf type in PCH file");
       Context->setsigjmp_bufDecl(Tag->getDecl());
     }
diff --git a/lib/Frontend/RewriteBlocks.cpp b/lib/Frontend/RewriteBlocks.cpp
index bc855fa..a7b5e3d 100644
--- a/lib/Frontend/RewriteBlocks.cpp
+++ b/lib/Frontend/RewriteBlocks.cpp
@@ -130,7 +130,7 @@
         OCT == Context->getCanonicalType(Context->getObjCClassType()))
       return true;
       
-    if (const PointerType *PT = OCT->getAsPointerType()) {
+    if (const PointerType *PT = OCT->getAs<PointerType>()) {
       if (isa<ObjCInterfaceType>(PT->getPointeeType()) || 
           PT->getPointeeType()->isObjCQualifiedIdType())
         return true;
@@ -684,13 +684,13 @@
   
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {
     closureName = DRE->getDecl()->getNameAsCString();
-    CPT = DRE->getType()->getAsBlockPointerType();
+    CPT = DRE->getType()->getAs<BlockPointerType>();
   } else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {
     closureName = CDRE->getDecl()->getNameAsCString();
-    CPT = CDRE->getType()->getAsBlockPointerType();
+    CPT = CDRE->getType()->getAs<BlockPointerType>();
   } else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {
     closureName = MExpr->getMemberDecl()->getNameAsCString();
-    CPT = MExpr->getType()->getAsBlockPointerType();
+    CPT = MExpr->getType()->getAs<BlockPointerType>();
   } else {
     assert(1 && "RewriteBlockClass: Bad type");
   }
@@ -813,11 +813,11 @@
 
 bool RewriteBlocks::PointerTypeTakesAnyBlockArguments(QualType QT) {
   const FunctionProtoType *FTP;
-  const PointerType *PT = QT->getAsPointerType();
+  const PointerType *PT = QT->getAs<PointerType>();
   if (PT) {
     FTP = PT->getPointeeType()->getAsFunctionProtoType();
   } else {
-    const BlockPointerType *BPT = QT->getAsBlockPointerType();
+    const BlockPointerType *BPT = QT->getAs<BlockPointerType>();
     assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");
     FTP = BPT->getPointeeType()->getAsFunctionProtoType();
   }
@@ -1068,7 +1068,7 @@
 }
 
 void RewriteBlocks::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) {
-  const PointerType *PT = funcType->getAsPointerType();
+  const PointerType *PT = funcType->getAs<PointerType>();
   if (PT && PointerTypeTakesAnyBlockArguments(funcType))
     RewriteFunctionProtoType(PT->getPointeeType(), ND);
 }
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp
index fa1476a..523e911 100644
--- a/lib/Frontend/RewriteObjC.cpp
+++ b/lib/Frontend/RewriteObjC.cpp
@@ -354,7 +354,7 @@
           OCT == Context->getCanonicalType(Context->getObjCClassType()))
         return true;
         
-      if (const PointerType *PT = OCT->getAsPointerType()) {
+      if (const PointerType *PT = OCT->getAs<PointerType>()) {
         if (isa<ObjCInterfaceType>(PT->getPointeeType()) || 
             PT->getPointeeType()->isObjCQualifiedIdType())
           return true;
@@ -394,7 +394,7 @@
 }
 
 void RewriteObjC::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) {
-  const PointerType *PT = funcType->getAsPointerType();
+  const PointerType *PT = funcType->getAs<PointerType>();
   if (PT && PointerTypeTakesAnyBlockArguments(funcType))
     RewriteBlocksInFunctionProtoType(PT->getPointeeType(), ND);
 }
@@ -864,9 +864,9 @@
     // syntax (where a decaration models use).
     QualType retType = OMD->getResultType();
     QualType PointeeTy;
-    if (const PointerType* PT = retType->getAsPointerType())
+    if (const PointerType* PT = retType->getAs<PointerType>())
       PointeeTy = PT->getPointeeType();
-    else if (const BlockPointerType *BPT = retType->getAsBlockPointerType())
+    else if (const BlockPointerType *BPT = retType->getAs<BlockPointerType>())
       PointeeTy = BPT->getPointeeType();
     if ((FPRetType = PointeeTy->getAsFunctionType())) {
       ResultStr += FPRetType->getResultType().getAsString();
@@ -939,7 +939,7 @@
       std::string Name = PDecl->getNameAsString();
       if (isTopLevelBlockPointerType(PDecl->getType())) {
         // Make sure we convert "t (^)(...)" to "t (*)(...)".
-        const BlockPointerType *BPT = PDecl->getType()->getAsBlockPointerType();
+        const BlockPointerType *BPT = PDecl->getType()->getAs<BlockPointerType>();
         Context->getPointerType(BPT->getPointeeType()).getAsStringInternal(Name,
                                                         Context->PrintingPolicy);
       } else
@@ -1138,7 +1138,7 @@
                                           SourceLocation OrigStart) {
   ObjCIvarDecl *D = IV->getDecl();
   if (CurMethodDef) {
-    if (const PointerType *pType = IV->getBase()->getType()->getAsPointerType()) {
+    if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
       ObjCInterfaceType *iFaceDecl =
         dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
       // lookup which class implements the instance variable.
@@ -1184,7 +1184,7 @@
       
     // Explicit ivar refs need to have a cast inserted.
     // FIXME: consider sharing some of this code with the code above.
-    if (const PointerType *pType = IV->getBase()->getType()->getAsPointerType()) {
+    if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
       ObjCInterfaceType *iFaceDecl = dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
       // lookup which class implements the instance variable.
       ObjCInterfaceDecl *clsDeclared = 0;
@@ -1608,7 +1608,7 @@
         buf += "1) { ";
         ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size());
         sawIdTypedCatch = true;
-      } else if (const PointerType *pType = t->getAsPointerType()) { 
+      } else if (const PointerType *pType = t->getAs<PointerType>()) { 
         ObjCInterfaceType *cls; // Should be a pointer to a class.
         
         cls = dyn_cast<ObjCInterfaceType>(pType->getPointeeType().getTypePtr());
@@ -2476,7 +2476,7 @@
                      : (*PI)->getType();
       // Make sure we convert "t (^)(...)" to "t (*)(...)".
       if (isTopLevelBlockPointerType(t)) {
-        const BlockPointerType *BPT = t->getAsBlockPointerType();
+        const BlockPointerType *BPT = t->getAs<BlockPointerType>();
         t = Context->getPointerType(BPT->getPointeeType());
       }
       ArgTypes.push_back(t);
@@ -3881,13 +3881,13 @@
   
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {
     closureName = DRE->getDecl()->getNameAsCString();
-    CPT = DRE->getType()->getAsBlockPointerType();
+    CPT = DRE->getType()->getAs<BlockPointerType>();
   } else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {
     closureName = CDRE->getDecl()->getNameAsCString();
-    CPT = CDRE->getType()->getAsBlockPointerType();
+    CPT = CDRE->getType()->getAs<BlockPointerType>();
   } else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {
     closureName = MExpr->getMemberDecl()->getNameAsCString();
-    CPT = MExpr->getType()->getAsBlockPointerType();
+    CPT = MExpr->getType()->getAs<BlockPointerType>();
   } else {
     assert(1 && "RewriteBlockClass: Bad type");
   }
@@ -3913,7 +3913,7 @@
       QualType t = *I;
       // Make sure we convert "t (^)(...)" to "t (*)(...)".
       if (isTopLevelBlockPointerType(t)) {
-        const BlockPointerType *BPT = t->getAsBlockPointerType();
+        const BlockPointerType *BPT = t->getAs<BlockPointerType>();
         t = Context->getPointerType(BPT->getPointeeType());
       }
       ArgTypes.push_back(t);
@@ -4054,11 +4054,11 @@
 
 bool RewriteObjC::PointerTypeTakesAnyBlockArguments(QualType QT) {
   const FunctionProtoType *FTP;
-  const PointerType *PT = QT->getAsPointerType();
+  const PointerType *PT = QT->getAs<PointerType>();
   if (PT) {
     FTP = PT->getPointeeType()->getAsFunctionProtoType();
   } else {
-    const BlockPointerType *BPT = QT->getAsBlockPointerType();
+    const BlockPointerType *BPT = QT->getAs<BlockPointerType>();
     assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");
     FTP = BPT->getPointeeType()->getAsFunctionProtoType();
   }