diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-29 21:53:49 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-29 21:53:49 +0000 |
commit | c23c7e6a51927d48a2d4d91a86bd422262f7352d (patch) | |
tree | 35b19b3eff4bfc9556abe0a4716d2e63da5a7152 /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | 4301526e8dad61db333728626e8fe3c916bb2cc2 (diff) | |
download | bcm5719-llvm-c23c7e6a51927d48a2d4d91a86bd422262f7352d.tar.gz bcm5719-llvm-c23c7e6a51927d48a2d4d91a86bd422262f7352d.zip |
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.
llvm-svn: 77510
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index dbe5e09fb5e..69f60568837 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -36,9 +36,9 @@ static const FunctionType *getFunctionType(Decl *d, bool blocksToo = true) { return 0; if (Ty->isFunctionPointerType()) - Ty = Ty->getAsPointerType()->getPointeeType(); + Ty = Ty->getAs<PointerType>()->getPointeeType(); else if (blocksToo && Ty->isBlockPointerType()) - Ty = Ty->getAsBlockPointerType()->getPointeeType(); + Ty = Ty->getAs<BlockPointerType>()->getPointeeType(); return Ty->getAsFunctionType(); } @@ -133,11 +133,11 @@ static inline bool isNSStringType(QualType T, ASTContext &Ctx) { } static inline bool isCFStringType(QualType T, ASTContext &Ctx) { - const PointerType *PT = T->getAsPointerType(); + const PointerType *PT = T->getAs<PointerType>(); if (!PT) return false; - const RecordType *RT = PT->getPointeeType()->getAsRecordType(); + const RecordType *RT = PT->getPointeeType()->getAs<RecordType>(); if (!RT) return false; @@ -631,7 +631,7 @@ static void HandleObjCNSObject(Decl *D, const AttributeList &Attr, Sema &S) { if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) { QualType T = TD->getUnderlyingType(); if (!T->isPointerType() || - !T->getAsPointerType()->getPointeeType()->isRecordType()) { + !T->getAs<PointerType>()->getPointeeType()->isRecordType()) { S.Diag(TD->getLocation(), diag::err_nsobject_attribute); return; } @@ -750,7 +750,7 @@ static void HandleSentinelAttr(Decl *d, const AttributeList &Attr, Sema &S) { QualType Ty = V->getType(); if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) { const FunctionType *FT = Ty->isFunctionPointerType() ? getFunctionType(d) - : Ty->getAsBlockPointerType()->getPointeeType()->getAsFunctionType(); + : Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType(); if (!cast<FunctionProtoType>(FT)->isVariadic()) { int m = Ty->isFunctionPointerType() ? 0 : 1; S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m; @@ -1145,7 +1145,7 @@ static void HandleFormatArgAttr(Decl *d, const AttributeList &Attr, Sema &S) { if (not_nsstring_type && !isCFStringType(Ty, S.Context) && (!Ty->isPointerType() || - !Ty->getAsPointerType()->getPointeeType()->isCharType())) { + !Ty->getAs<PointerType>()->getPointeeType()->isCharType())) { // FIXME: Should highlight the actual expression that has the wrong type. S.Diag(Attr.getLoc(), diag::err_format_attribute_not) << (not_nsstring_type ? "a string type" : "an NSString") @@ -1156,7 +1156,7 @@ static void HandleFormatArgAttr(Decl *d, const AttributeList &Attr, Sema &S) { if (!isNSStringType(Ty, S.Context) && !isCFStringType(Ty, S.Context) && (!Ty->isPointerType() || - !Ty->getAsPointerType()->getPointeeType()->isCharType())) { + !Ty->getAs<PointerType>()->getPointeeType()->isCharType())) { // FIXME: Should highlight the actual expression that has the wrong type. S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not) << (not_nsstring_type ? "string type" : "NSString") @@ -1264,7 +1264,7 @@ static void HandleFormatAttr(Decl *d, const AttributeList &Attr, Sema &S) { return; } } else if (!Ty->isPointerType() || - !Ty->getAsPointerType()->getPointeeType()->isCharType()) { + !Ty->getAs<PointerType>()->getPointeeType()->isCharType()) { // FIXME: Should highlight the actual expression that has the wrong type. S.Diag(Attr.getLoc(), diag::err_format_attribute_not) << "a string type" << IdxExpr->getSourceRange(); @@ -1700,7 +1700,7 @@ static void HandleNSReturnsRetainedAttr(Decl *d, const AttributeList &Attr, return; } - if (!(S.Context.isObjCNSObjectType(RetTy) || RetTy->getAsPointerType() + if (!(S.Context.isObjCNSObjectType(RetTy) || RetTy->getAs<PointerType>() || RetTy->getAsObjCObjectPointerType())) { S.Diag(Attr.getLoc(), diag::warn_ns_attribute_wrong_return_type) << Attr.getName(); |