summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp20
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();
OpenPOWER on IntegriCloud