summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-21 23:43:11 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-21 23:43:11 +0000
commit9dd450bb781484ca4b870529f89842541045c153 (patch)
treeb2033fb4eef5442d9d080df4ae39137b696dcd4e /clang/lib/Frontend
parentfd68c7bdc0ea3a61b90380eab3db89230c6b5f27 (diff)
downloadbcm5719-llvm-9dd450bb781484ca4b870529f89842541045c153.tar.gz
bcm5719-llvm-9dd450bb781484ca4b870529f89842541045c153.zip
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. llvm-svn: 82501
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/DocumentXML.cpp2
-rw-r--r--clang/lib/Frontend/PCHReader.cpp6
-rw-r--r--clang/lib/Frontend/RewriteBlocks.cpp6
-rw-r--r--clang/lib/Frontend/RewriteObjC.cpp18
4 files changed, 16 insertions, 16 deletions
diff --git a/clang/lib/Frontend/DocumentXML.cpp b/clang/lib/Frontend/DocumentXML.cpp
index 6dcb6ae45a2..a6af2f8ecfa 100644
--- a/clang/lib/Frontend/DocumentXML.cpp
+++ b/clang/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/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index 9c855eb26f1..e85f58b0e91 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/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/clang/lib/Frontend/RewriteBlocks.cpp b/clang/lib/Frontend/RewriteBlocks.cpp
index b29f9eac49d..25e7fc42384 100644
--- a/clang/lib/Frontend/RewriteBlocks.cpp
+++ b/clang/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/clang/lib/Frontend/RewriteObjC.cpp b/clang/lib/Frontend/RewriteObjC.cpp
index 323804744d3..57b1fc31a84 100644
--- a/clang/lib/Frontend/RewriteObjC.cpp
+++ b/clang/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(),
OpenPOWER on IntegriCloud