diff options
author | John McCall <rjmccall@apple.com> | 2009-09-21 23:43:11 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-09-21 23:43:11 +0000 |
commit | 183700f494ec9b6701b6efe82bcb25f4c79ba561 (patch) | |
tree | 797f214407f66937802226652d130f95d596e33b /lib/Frontend | |
parent | c32b24452ebb537934b20b7133a3a0cbce447666 (diff) |
Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.
The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/DocumentXML.cpp | 2 | ||||
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 6 | ||||
-rw-r--r-- | lib/Frontend/RewriteBlocks.cpp | 6 | ||||
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 18 |
4 files changed, 16 insertions, 16 deletions
diff --git a/lib/Frontend/DocumentXML.cpp b/lib/Frontend/DocumentXML.cpp index 6dcb6ae45a..a6af2f8ecf 100644 --- a/lib/Frontend/DocumentXML.cpp +++ b/lib/Frontend/DocumentXML.cpp @@ -161,7 +161,7 @@ void DocumentXML::finalize() { if (const TagDecl *TD = dyn_cast<TagDecl>(i->first)) addAttribute("type", getPrefixedId(BasicTypes[TD->getTypeForDecl()], ID_NORMAL)); else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(i->first)) - addAttribute("type", getPrefixedId(BasicTypes[FD->getType()->getAsFunctionType()], ID_NORMAL)); + addAttribute("type", getPrefixedId(BasicTypes[FD->getType()->getAs<FunctionType>()], ID_NORMAL)); if (const DeclContext* parent = i->first->getParent()) addAttribute("context", parent); diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 9c855eb26f..e85f58b0e9 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1536,7 +1536,7 @@ void PCHReader::InitializeContext(ASTContext &Ctx) { if (unsigned File = SpecialTypes[pch::SPECIAL_TYPE_FILE]) { QualType FileType = GetType(File); assert(!FileType.isNull() && "FILE type is NULL"); - if (const TypedefType *Typedef = FileType->getAsTypedefType()) + if (const TypedefType *Typedef = FileType->getAs<TypedefType>()) Context->setFILEDecl(Typedef->getDecl()); else { const TagType *Tag = FileType->getAs<TagType>(); @@ -1547,7 +1547,7 @@ void PCHReader::InitializeContext(ASTContext &Ctx) { if (unsigned Jmp_buf = SpecialTypes[pch::SPECIAL_TYPE_jmp_buf]) { QualType Jmp_bufType = GetType(Jmp_buf); assert(!Jmp_bufType.isNull() && "jmp_bug type is NULL"); - if (const TypedefType *Typedef = Jmp_bufType->getAsTypedefType()) + if (const TypedefType *Typedef = Jmp_bufType->getAs<TypedefType>()) Context->setjmp_bufDecl(Typedef->getDecl()); else { const TagType *Tag = Jmp_bufType->getAs<TagType>(); @@ -1558,7 +1558,7 @@ void PCHReader::InitializeContext(ASTContext &Ctx) { if (unsigned Sigjmp_buf = SpecialTypes[pch::SPECIAL_TYPE_sigjmp_buf]) { QualType Sigjmp_bufType = GetType(Sigjmp_buf); assert(!Sigjmp_bufType.isNull() && "sigjmp_buf type is NULL"); - if (const TypedefType *Typedef = Sigjmp_bufType->getAsTypedefType()) + if (const TypedefType *Typedef = Sigjmp_bufType->getAs<TypedefType>()) Context->setsigjmp_bufDecl(Typedef->getDecl()); else { const TagType *Tag = Sigjmp_bufType->getAs<TagType>(); diff --git a/lib/Frontend/RewriteBlocks.cpp b/lib/Frontend/RewriteBlocks.cpp index b29f9eac49..25e7fc4238 100644 --- a/lib/Frontend/RewriteBlocks.cpp +++ b/lib/Frontend/RewriteBlocks.cpp @@ -694,7 +694,7 @@ std::string RewriteBlocks::SynthesizeBlockCall(CallExpr *Exp) { assert(1 && "RewriteBlockClass: Bad type"); } assert(CPT && "RewriteBlockClass: Bad type"); - const FunctionType *FT = CPT->getPointeeType()->getAsFunctionType(); + const FunctionType *FT = CPT->getPointeeType()->getAs<FunctionType>(); assert(FT && "RewriteBlockClass: Bad type"); const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FT); // FTP will be null for closures that don't take arguments. @@ -814,11 +814,11 @@ bool RewriteBlocks::PointerTypeTakesAnyBlockArguments(QualType QT) { const FunctionProtoType *FTP; const PointerType *PT = QT->getAs<PointerType>(); if (PT) { - FTP = PT->getPointeeType()->getAsFunctionProtoType(); + FTP = PT->getPointeeType()->getAs<FunctionProtoType>(); } else { const BlockPointerType *BPT = QT->getAs<BlockPointerType>(); assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type"); - FTP = BPT->getPointeeType()->getAsFunctionProtoType(); + FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index 323804744d..57b1fc31a8 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -868,7 +868,7 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD, PointeeTy = PT->getPointeeType(); else if (const BlockPointerType *BPT = retType->getAs<BlockPointerType>()) PointeeTy = BPT->getPointeeType(); - if ((FPRetType = PointeeTy->getAsFunctionType())) { + if ((FPRetType = PointeeTy->getAs<FunctionType>())) { ResultStr += FPRetType->getResultType().getAsString(); ResultStr += "(*"; } @@ -1790,7 +1790,7 @@ CallExpr *RewriteObjC::SynthesizeCallToFunctionDecl( DRE, /*isLvalue=*/false); - const FunctionType *FT = msgSendType->getAsFunctionType(); + const FunctionType *FT = msgSendType->getAs<FunctionType>(); return new (Context) CallExpr(*Context, ICE, args, nargs, FT->getResultType(), SourceLocation()); @@ -1871,7 +1871,7 @@ void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) { Loc = FD->getLocation(); // Check for ObjC 'id' and class types that have been adorned with protocol // information (id<p>, C<p>*). The protocol references need to be rewritten! - const FunctionType *funcType = FD->getType()->getAsFunctionType(); + const FunctionType *funcType = FD->getType()->getAs<FunctionType>(); assert(funcType && "missing function type"); proto = dyn_cast<FunctionProtoType>(funcType); if (!proto) @@ -2164,7 +2164,7 @@ ObjCInterfaceDecl *RewriteObjC::isSuperReceiver(Expr *recExpr) { if (ObjCSuperExpr *Super = dyn_cast<ObjCSuperExpr>(recExpr)) { const ObjCObjectPointerType *OPT = - Super->getType()->getAsObjCObjectPointerType(); + Super->getType()->getAs<ObjCObjectPointerType>(); assert(OPT); const ObjCInterfaceType *IT = OPT->getInterfaceType(); return IT->getDecl(); @@ -2535,7 +2535,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { // Don't forget the parens to enforce the proper binding. ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), cast); - const FunctionType *FT = msgSendType->getAsFunctionType(); + const FunctionType *FT = msgSendType->getAs<FunctionType>(); CallExpr *CE = new (Context) CallExpr(*Context, PE, &MsgExprs[0], MsgExprs.size(), FT->getResultType(), SourceLocation()); @@ -2565,7 +2565,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { // Don't forget the parens to enforce the proper binding. PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), cast); - FT = msgSendType->getAsFunctionType(); + FT = msgSendType->getAs<FunctionType>(); CallExpr *STCE = new (Context) CallExpr(*Context, PE, &MsgExprs[0], MsgExprs.size(), FT->getResultType(), SourceLocation()); @@ -3920,7 +3920,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) { assert(1 && "RewriteBlockClass: Bad type"); } assert(CPT && "RewriteBlockClass: Bad type"); - const FunctionType *FT = CPT->getPointeeType()->getAsFunctionType(); + const FunctionType *FT = CPT->getPointeeType()->getAs<FunctionType>(); assert(FT && "RewriteBlockClass: Bad type"); const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FT); // FTP will be null for closures that don't take arguments. @@ -4087,11 +4087,11 @@ bool RewriteObjC::PointerTypeTakesAnyBlockArguments(QualType QT) { const FunctionProtoType *FTP; const PointerType *PT = QT->getAs<PointerType>(); if (PT) { - FTP = PT->getPointeeType()->getAsFunctionProtoType(); + FTP = PT->getPointeeType()->getAs<FunctionProtoType>(); } else { const BlockPointerType *BPT = QT->getAs<BlockPointerType>(); assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type"); - FTP = BPT->getPointeeType()->getAsFunctionProtoType(); + FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), |