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
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index a8a6095..1e26c35 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -199,7 +199,7 @@
bool HasVAListArg = Format->getFirstArg() == 0;
if (!HasVAListArg) {
if (const FunctionProtoType *Proto
- = FDecl->getType()->getAsFunctionProtoType())
+ = FDecl->getType()->getAs<FunctionProtoType>())
HasVAListArg = !Proto->isVariadic();
}
CheckPrintfArguments(TheCall, HasVAListArg, Format->getFormatIdx() - 1,
@@ -234,7 +234,7 @@
bool HasVAListArg = Format->getFirstArg() == 0;
if (!HasVAListArg) {
const FunctionType *FT =
- Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
+ Ty->getAs<BlockPointerType>()->getPointeeType()->getAs<FunctionType>();
if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FT))
HasVAListArg = !Proto->isVariadic();
}
@@ -372,7 +372,7 @@
cast<FunctionDecl>(LazilyCreateBuiltin(NewBuiltinII, NewBuiltinID,
TUScope, false, DRE->getLocStart()));
const FunctionProtoType *BuiltinFT =
- NewBuiltinDecl->getType()->getAsFunctionProtoType();
+ NewBuiltinDecl->getType()->getAs<FunctionProtoType>();
ValType = BuiltinFT->getArgType(0)->getAs<PointerType>()->getPointeeType();
// If the first type needs to be converted (e.g. void** -> int*), do it now.
@@ -633,7 +633,7 @@
return ExprError();
}
- numElements = FAType->getAsVectorType()->getNumElements();
+ numElements = FAType->getAs<VectorType>()->getNumElements();
if (TheCall->getNumArgs() != numElements+2) {
if (TheCall->getNumArgs() < numElements+2)
return ExprError(Diag(TheCall->getLocEnd(),
@@ -694,7 +694,7 @@
QualType RWType = Arg->getType();
- const BuiltinType *BT = RWType->getAsBuiltinType();
+ const BuiltinType *BT = RWType->getAs<BuiltinType>();
llvm::APSInt Result;
if (!BT || BT->getKind() != BuiltinType::Int)
return Diag(TheCall->getLocStart(), diag::err_prefetch_invalid_argument)
@@ -733,7 +733,7 @@
return false;
QualType ArgType = Arg->getType();
- const BuiltinType *BT = ArgType->getAsBuiltinType();
+ const BuiltinType *BT = ArgType->getAs<BuiltinType>();
llvm::APSInt Result(32);
if (!BT || BT->getKind() != BuiltinType::Int)
return Diag(TheCall->getLocStart(), diag::err_object_size_invalid_argument)
@@ -1092,7 +1092,7 @@
// Perform type checking on width/precision specifier.
const Expr *E = TheCall->getArg(format_idx+numConversions);
- if (const BuiltinType *BT = E->getType()->getAsBuiltinType())
+ if (const BuiltinType *BT = E->getType()->getAs<BuiltinType>())
if (BT->getKind() == BuiltinType::Int)
break;
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index f5a3dc4..084b2ef 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -766,8 +766,8 @@
// duplicate function decls like "void f(int); void f(enum X);" properly.
if (!getLangOptions().CPlusPlus &&
Context.typesAreCompatible(OldQType, NewQType)) {
- const FunctionType *OldFuncType = OldQType->getAsFunctionType();
- const FunctionType *NewFuncType = NewQType->getAsFunctionType();
+ const FunctionType *OldFuncType = OldQType->getAs<FunctionType>();
+ const FunctionType *NewFuncType = NewQType->getAs<FunctionType>();
const FunctionProtoType *OldProto = 0;
if (isa<FunctionNoProtoType>(NewFuncType) &&
(OldProto = dyn_cast<FunctionProtoType>(OldFuncType))) {
@@ -816,14 +816,14 @@
// C99 6.9.1p8.
if (!getLangOptions().CPlusPlus &&
Old->hasPrototype() && !New->hasPrototype() &&
- New->getType()->getAsFunctionProtoType() &&
+ New->getType()->getAs<FunctionProtoType>() &&
Old->getNumParams() == New->getNumParams()) {
llvm::SmallVector<QualType, 16> ArgTypes;
llvm::SmallVector<GNUCompatibleParamWarning, 16> Warnings;
const FunctionProtoType *OldProto
- = Old->getType()->getAsFunctionProtoType();
+ = Old->getType()->getAs<FunctionProtoType>();
const FunctionProtoType *NewProto
- = New->getType()->getAsFunctionProtoType();
+ = New->getType()->getAs<FunctionProtoType>();
// Determine whether this is the GNU C extension.
QualType MergedReturn = Context.mergeTypes(OldProto->getResultType(),
@@ -1195,7 +1195,7 @@
return;
bool ReturnsVoid = false;
bool HasNoReturn = false;
- if (const FunctionType *FT = BlockTy->getPointeeType()->getAsFunctionType()) {
+ if (const FunctionType *FT = BlockTy->getPointeeType()->getAs<FunctionType>()) {
if (FT->getResultType()->isVoidType())
ReturnsVoid = true;
if (FT->getNoReturnAttr())
@@ -2389,16 +2389,16 @@
// the class has been completely parsed.
if (!DC->isRecord() &&
RequireNonAbstractType(D.getIdentifierLoc(),
- R->getAsFunctionType()->getResultType(),
+ R->getAs<FunctionType>()->getResultType(),
diag::err_abstract_type_in_decl,
AbstractReturnType))
D.setInvalidType();
// Do not allow returning a objc interface by-value.
- if (R->getAsFunctionType()->getResultType()->isObjCInterfaceType()) {
+ if (R->getAs<FunctionType>()->getResultType()->isObjCInterfaceType()) {
Diag(D.getIdentifierLoc(),
diag::err_object_cannot_be_passed_returned_by_value) << 0
- << R->getAsFunctionType()->getResultType();
+ << R->getAs<FunctionType>()->getResultType();
D.setInvalidType();
}
@@ -2641,7 +2641,7 @@
}
}
- } else if (const FunctionProtoType *FT = R->getAsFunctionProtoType()) {
+ } else if (const FunctionProtoType *FT = R->getAs<FunctionProtoType>()) {
// When we're declaring a function with a typedef, typeof, etc as in the
// following example, we'll need to synthesize (unnamed)
// parameters for use in the declaration.
@@ -2824,14 +2824,14 @@
// Functions marked "overloadable" must have a prototype (that
// we can't get through declaration merging).
- if (!NewFD->getType()->getAsFunctionProtoType()) {
+ if (!NewFD->getType()->getAs<FunctionProtoType>()) {
Diag(NewFD->getLocation(), diag::err_attribute_overloadable_no_prototype)
<< NewFD;
Redeclaration = true;
// Turn this into a variadic function with no parameters.
QualType R = Context.getFunctionType(
- NewFD->getType()->getAsFunctionType()->getResultType(),
+ NewFD->getType()->getAs<FunctionType>()->getResultType(),
0, 0, true, 0);
NewFD->setType(R);
return NewFD->setInvalidDecl();
@@ -2927,7 +2927,7 @@
QualType T = FD->getType();
assert(T->isFunctionType() && "function decl is not of function type");
- const FunctionType* FT = T->getAsFunctionType();
+ const FunctionType* FT = T->getAs<FunctionType>();
if (!Context.hasSameUnqualifiedType(FT->getResultType(), Context.IntTy)) {
// TODO: add a replacement fixit to turn the return type into 'int'.
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 5987c96..a23da41 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -41,7 +41,7 @@
else if (blocksToo && Ty->isBlockPointerType())
Ty = Ty->getAs<BlockPointerType>()->getPointeeType();
- return Ty->getAsFunctionType();
+ return Ty->getAs<FunctionType>();
}
// FIXME: We should provide an abstraction around a method or function
@@ -124,11 +124,11 @@
}
static inline bool isNSStringType(QualType T, ASTContext &Ctx) {
- const ObjCObjectPointerType *PT = T->getAsObjCObjectPointerType();
+ const ObjCObjectPointerType *PT = T->getAs<ObjCObjectPointerType>();
if (!PT)
return false;
- const ObjCInterfaceType *ClsT =PT->getPointeeType()->getAsObjCInterfaceType();
+ const ObjCInterfaceType *ClsT =PT->getPointeeType()->getAs<ObjCInterfaceType>();
if (!ClsT)
return false;
@@ -750,7 +750,7 @@
}
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(d)) {
- const FunctionType *FT = FD->getType()->getAsFunctionType();
+ const FunctionType *FT = FD->getType()->getAs<FunctionType>();
assert(FT && "FunctionDecl has non-function type?");
if (isa<FunctionNoProtoType>(FT)) {
@@ -775,7 +775,7 @@
QualType Ty = V->getType();
if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) {
const FunctionType *FT = Ty->isFunctionPointerType() ? getFunctionType(d)
- : Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
+ : Ty->getAs<BlockPointerType>()->getPointeeType()->getAs<FunctionType>();
if (!cast<FunctionProtoType>(FT)->isVariadic()) {
int m = Ty->isFunctionPointerType() ? 0 : 1;
S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m;
@@ -1549,7 +1549,7 @@
return;
}
- if (!OldTy->getAsBuiltinType() && !OldTy->isComplexType())
+ if (!OldTy->getAs<BuiltinType>() && !OldTy->isComplexType())
S.Diag(Attr.getLoc(), diag::err_mode_not_primitive);
else if (IntegerMode) {
if (!OldTy->isIntegralType())
@@ -1746,7 +1746,7 @@
}
if (!(S.Context.isObjCNSObjectType(RetTy) || RetTy->getAs<PointerType>()
- || RetTy->getAsObjCObjectPointerType())) {
+ || RetTy->getAs<ObjCObjectPointerType>())) {
SourceLocation L = Attr.getLoc();
S.Diag(d->getLocStart(), diag::warn_ns_attribute_wrong_return_type)
<< SourceRange(L, L) << Attr.getName();
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 75718dd..1896fb0 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -325,8 +325,8 @@
}
if (CheckEquivalentExceptionSpec(
- Old->getType()->getAsFunctionProtoType(), Old->getLocation(),
- New->getType()->getAsFunctionProtoType(), New->getLocation())) {
+ Old->getType()->getAs<FunctionProtoType>(), Old->getLocation(),
+ New->getType()->getAs<FunctionProtoType>(), New->getLocation())) {
Invalid = true;
}
@@ -1632,7 +1632,7 @@
}
// Check the return type.
- QualType RTy = FD->getType()->getAsFunctionType()->getResultType();
+ QualType RTy = FD->getType()->getAs<FunctionType>()->getResultType();
bool Invalid =
SemaRef.RequireNonAbstractType(FD->getLocation(), RTy,
diag::err_abstract_type_in_decl,
@@ -2062,7 +2062,7 @@
// return type, since constructors don't have return types. We
// *always* have to do this, because GetTypeForDeclarator will
// put in a result type of "int" when none was specified.
- const FunctionProtoType *Proto = R->getAsFunctionProtoType();
+ const FunctionProtoType *Proto = R->getAs<FunctionProtoType>();
return Context.getFunctionType(Context.VoidTy, Proto->arg_type_begin(),
Proto->getNumArgs(),
Proto->isVariadic(), 0);
@@ -2229,7 +2229,7 @@
}
// Make sure we don't have any parameters.
- if (R->getAsFunctionProtoType()->getNumArgs() > 0) {
+ if (R->getAs<FunctionProtoType>()->getNumArgs() > 0) {
Diag(D.getIdentifierLoc(), diag::err_conv_function_with_params);
// Delete the parameters.
@@ -2238,7 +2238,7 @@
}
// Make sure the conversion function isn't variadic.
- if (R->getAsFunctionProtoType()->isVariadic() && !D.isInvalidType()) {
+ if (R->getAs<FunctionProtoType>()->isVariadic() && !D.isInvalidType()) {
Diag(D.getIdentifierLoc(), diag::err_conv_function_variadic);
D.setInvalidType();
}
@@ -2261,7 +2261,7 @@
// of the errors above fired) and with the conversion type as the
// return type.
R = Context.getFunctionType(ConvType, 0, 0, false,
- R->getAsFunctionProtoType()->getTypeQuals());
+ R->getAs<FunctionProtoType>()->getTypeQuals());
// C++0x explicit conversion operators.
if (D.getDeclSpec().isExplicitSpecified() && !getLangOptions().CPlusPlus0x)
@@ -3799,7 +3799,7 @@
// Overloaded operators other than operator() cannot be variadic.
if (Op != OO_Call &&
- FnDecl->getType()->getAsFunctionProtoType()->isVariadic()) {
+ FnDecl->getType()->getAs<FunctionProtoType>()->isVariadic()) {
return Diag(FnDecl->getLocation(), diag::err_operator_overload_variadic)
<< FnDecl->getDeclName();
}
@@ -3824,7 +3824,7 @@
if ((Op == OO_PlusPlus || Op == OO_MinusMinus) && NumParams == 2) {
ParmVarDecl *LastParam = FnDecl->getParamDecl(FnDecl->getNumParams() - 1);
bool ParamIsInt = false;
- if (const BuiltinType *BT = LastParam->getType()->getAsBuiltinType())
+ if (const BuiltinType *BT = LastParam->getType()->getAs<BuiltinType>())
ParamIsInt = BT->getKind() == BuiltinType::Int;
if (!ParamIsInt)
@@ -4382,8 +4382,8 @@
bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
const CXXMethodDecl *Old) {
- QualType NewTy = New->getType()->getAsFunctionType()->getResultType();
- QualType OldTy = Old->getType()->getAsFunctionType()->getResultType();
+ QualType NewTy = New->getType()->getAs<FunctionType>()->getResultType();
+ QualType OldTy = Old->getType()->getAs<FunctionType>()->getResultType();
QualType CNewTy = Context.getCanonicalType(NewTy);
QualType COldTy = Context.getCanonicalType(OldTy);
@@ -4465,9 +4465,9 @@
const CXXMethodDecl *Old) {
return CheckExceptionSpecSubset(diag::err_override_exception_spec,
diag::note_overridden_virtual_function,
- Old->getType()->getAsFunctionProtoType(),
+ Old->getType()->getAs<FunctionProtoType>(),
Old->getLocation(),
- New->getType()->getAsFunctionProtoType(),
+ New->getType()->getAs<FunctionProtoType>(),
New->getLocation());
}
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 43d38f0..c11b4e0 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -143,7 +143,7 @@
if (const TypedefDecl *TDecl = dyn_cast_or_null<TypedefDecl>(PrevDecl)) {
QualType T = TDecl->getUnderlyingType();
if (T->isObjCInterfaceType()) {
- if (NamedDecl *IDecl = T->getAsObjCInterfaceType()->getDecl())
+ if (NamedDecl *IDecl = T->getAs<ObjCInterfaceType>()->getDecl())
SuperClassDecl = dyn_cast<ObjCInterfaceDecl>(IDecl);
}
}
@@ -209,7 +209,7 @@
if (const TypedefDecl *TDecl = dyn_cast_or_null<TypedefDecl>(CDeclU)) {
QualType T = TDecl->getUnderlyingType();
if (T->isObjCInterfaceType()) {
- if (NamedDecl *IDecl = T->getAsObjCInterfaceType()->getDecl()) {
+ if (NamedDecl *IDecl = T->getAs<ObjCInterfaceType>()->getDecl()) {
ClassName = IDecl->getIdentifier();
CDeclU = LookupName(TUScope, ClassName, LookupOrdinaryName);
}
@@ -1939,7 +1939,7 @@
if (T->isObjCObjectPointerType()) {
QualType InterfaceTy = T->getPointeeType();
if (const ObjCInterfaceType *OIT =
- InterfaceTy->getAsObjCInterfaceType()) {
+ InterfaceTy->getAs<ObjCInterfaceType>()) {
ObjCInterfaceDecl *IDecl = OIT->getDecl();
if (IDecl)
if (ObjCProtocolDecl* PNSCopying =
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 70e1374..333cd35 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -132,8 +132,8 @@
QualType Ty = V->getType();
if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) {
const FunctionType *FT = Ty->isFunctionPointerType()
- ? Ty->getAs<PointerType>()->getPointeeType()->getAsFunctionType()
- : Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
+ ? Ty->getAs<PointerType>()->getPointeeType()->getAs<FunctionType>()
+ : Ty->getAs<BlockPointerType>()->getPointeeType()->getAs<FunctionType>();
if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FT)) {
unsigned NumArgsInProto = Proto->getNumArgs();
unsigned k;
@@ -261,7 +261,7 @@
assert(!Ty.isNull() && "DefaultArgumentPromotion - missing type");
// If this is a 'float' (CVR qualified or typedef) promote to double.
- if (const BuiltinType *BT = Ty->getAsBuiltinType())
+ if (const BuiltinType *BT = Ty->getAs<BuiltinType>())
if (BT->getKind() == BuiltinType::Float)
return ImpCastExprToType(Expr, Context.DoubleTy);
@@ -842,7 +842,7 @@
QualType T = Func->getType();
QualType NoProtoType = T;
- if (const FunctionProtoType *Proto = T->getAsFunctionProtoType())
+ if (const FunctionProtoType *Proto = T->getAs<FunctionProtoType>())
NoProtoType = Context.getFunctionNoProtoType(Proto->getResultType());
return BuildDeclRefExpr(Func, NoProtoType, Loc, false, false, SS);
}
@@ -1483,7 +1483,7 @@
return Context.DependentTy;
// These operators return the element type of a complex type.
- if (const ComplexType *CT = V->getType()->getAsComplexType())
+ if (const ComplexType *CT = V->getType()->getAs<ComplexType>())
return CT->getElementType();
// Otherwise they pass through real integer and floating point types here.
@@ -1562,7 +1562,7 @@
// Determine the result type
QualType ResultTy
- = FnDecl->getType()->getAsFunctionType()->getResultType();
+ = FnDecl->getType()->getAs<FunctionType>()->getResultType();
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
@@ -1678,7 +1678,7 @@
// Determine the result type
QualType ResultTy
- = FnDecl->getType()->getAsFunctionType()->getResultType();
+ = FnDecl->getType()->getAs<FunctionType>()->getResultType();
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
@@ -1759,17 +1759,17 @@
IndexExpr = LHSExp;
ResultType = PTy->getPointeeType();
} else if (const ObjCObjectPointerType *PTy =
- LHSTy->getAsObjCObjectPointerType()) {
+ LHSTy->getAs<ObjCObjectPointerType>()) {
BaseExpr = LHSExp;
IndexExpr = RHSExp;
ResultType = PTy->getPointeeType();
} else if (const ObjCObjectPointerType *PTy =
- RHSTy->getAsObjCObjectPointerType()) {
+ RHSTy->getAs<ObjCObjectPointerType>()) {
// Handle the uncommon case of "123[Ptr]".
BaseExpr = RHSExp;
IndexExpr = LHSExp;
ResultType = PTy->getPointeeType();
- } else if (const VectorType *VTy = LHSTy->getAsVectorType()) {
+ } else if (const VectorType *VTy = LHSTy->getAs<VectorType>()) {
BaseExpr = LHSExp; // vectors: V[123]
IndexExpr = RHSExp;
@@ -1847,7 +1847,7 @@
CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
const IdentifierInfo *CompName,
SourceLocation CompLoc) {
- const ExtVectorType *vecType = baseType->getAsExtVectorType();
+ const ExtVectorType *vecType = baseType->getAs<ExtVectorType>();
// The vector accessor can't exceed the number of elements.
const char *compStr = CompName->getName();
@@ -2355,9 +2355,9 @@
// (*Obj).ivar.
if ((OpKind == tok::arrow && BaseType->isObjCObjectPointerType()) ||
(OpKind == tok::period && BaseType->isObjCInterfaceType())) {
- const ObjCObjectPointerType *OPT = BaseType->getAsObjCObjectPointerType();
+ const ObjCObjectPointerType *OPT = BaseType->getAs<ObjCObjectPointerType>();
const ObjCInterfaceType *IFaceT =
- OPT ? OPT->getInterfaceType() : BaseType->getAsObjCInterfaceType();
+ OPT ? OPT->getInterfaceType() : BaseType->getAs<ObjCInterfaceType>();
if (IFaceT) {
IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
@@ -2419,7 +2419,7 @@
// Handle properties on 'id' and qualified "id".
if (OpKind == tok::period && (BaseType->isObjCIdType() ||
BaseType->isObjCQualifiedIdType())) {
- const ObjCObjectPointerType *QIdTy = BaseType->getAsObjCObjectPointerType();
+ const ObjCObjectPointerType *QIdTy = BaseType->getAs<ObjCObjectPointerType>();
IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
// Check protocols on qualified interfaces.
@@ -2936,10 +2936,10 @@
if (PT == 0)
return ExprError(Diag(LParenLoc, diag::err_typecheck_call_not_function)
<< Fn->getType() << Fn->getSourceRange());
- FuncT = PT->getPointeeType()->getAsFunctionType();
+ FuncT = PT->getPointeeType()->getAs<FunctionType>();
} else { // This is a block call.
FuncT = Fn->getType()->getAs<BlockPointerType>()->getPointeeType()->
- getAsFunctionType();
+ getAs<FunctionType>();
}
if (FuncT == 0)
return ExprError(Diag(LParenLoc, diag::err_typecheck_call_not_function)
@@ -2969,7 +2969,7 @@
const FunctionDecl *Def = 0;
if (FDecl->getBody(Def) && NumArgs != Def->param_size()) {
const FunctionProtoType *Proto =
- Def->getType()->getAsFunctionProtoType();
+ Def->getType()->getAs<FunctionProtoType>();
if (!Proto || !(Proto->isVariadic() && NumArgs >= Def->param_size())) {
Diag(RParenLoc, diag::warn_call_wrong_number_of_arguments)
<< (NumArgs > Def->param_size()) << FDecl << Fn->getSourceRange();
@@ -3422,8 +3422,8 @@
// Two identical object pointer types are always compatible.
return LHSTy;
}
- const ObjCObjectPointerType *LHSOPT = LHSTy->getAsObjCObjectPointerType();
- const ObjCObjectPointerType *RHSOPT = RHSTy->getAsObjCObjectPointerType();
+ const ObjCObjectPointerType *LHSOPT = LHSTy->getAs<ObjCObjectPointerType>();
+ const ObjCObjectPointerType *RHSOPT = RHSTy->getAs<ObjCObjectPointerType>();
QualType compositeType = LHSTy;
// If both operands are interfaces and either operand can be
@@ -3470,7 +3470,7 @@
// Check Objective-C object pointer types and 'void *'
if (LHSTy->isVoidPointerType() && RHSTy->isObjCObjectPointerType()) {
QualType lhptee = LHSTy->getAs<PointerType>()->getPointeeType();
- QualType rhptee = RHSTy->getAsObjCObjectPointerType()->getPointeeType();
+ QualType rhptee = RHSTy->getAs<ObjCObjectPointerType>()->getPointeeType();
QualType destPointee = lhptee.getQualifiedType(rhptee.getCVRQualifiers());
QualType destType = Context.getPointerType(destPointee);
ImpCastExprToType(LHS, destType); // add qualifiers if necessary
@@ -3478,7 +3478,7 @@
return destType;
}
if (LHSTy->isObjCObjectPointerType() && RHSTy->isVoidPointerType()) {
- QualType lhptee = LHSTy->getAsObjCObjectPointerType()->getPointeeType();
+ QualType lhptee = LHSTy->getAs<ObjCObjectPointerType>()->getPointeeType();
QualType rhptee = RHSTy->getAs<PointerType>()->getPointeeType();
QualType destPointee = rhptee.getQualifiedType(lhptee.getCVRQualifiers());
QualType destType = Context.getPointerType(destPointee);
@@ -4021,8 +4021,8 @@
// type. It would be nice if we only had one vector type someday.
if (getLangOptions().LaxVectorConversions) {
// FIXME: Should we warn here?
- if (const VectorType *LV = lhsType->getAsVectorType()) {
- if (const VectorType *RV = rhsType->getAsVectorType())
+ if (const VectorType *LV = lhsType->getAs<VectorType>()) {
+ if (const VectorType *RV = rhsType->getAs<VectorType>())
if (LV->getElementType() == RV->getElementType() &&
LV->getNumElements() == RV->getNumElements()) {
return lhsType->isExtVectorType() ? lhsType : rhsType;
@@ -4040,7 +4040,7 @@
}
// Handle the case of an ext vector and scalar.
- if (const ExtVectorType *LV = lhsType->getAsExtVectorType()) {
+ if (const ExtVectorType *LV = lhsType->getAs<ExtVectorType>()) {
QualType EltTy = LV->getElementType();
if (EltTy->isIntegralType() && rhsType->isIntegralType()) {
if (Context.getIntegerTypeOrder(EltTy, rhsType) >= 0) {
@@ -4695,7 +4695,7 @@
if (lType->isIntegerType())
return lType;
- const VectorType *VTy = lType->getAsVectorType();
+ const VectorType *VTy = lType->getAs<VectorType>();
unsigned TypeSize = Context.getTypeSize(VTy->getElementType());
if (TypeSize == Context.getTypeSize(Context.IntTy))
return Context.getExtVectorType(Context.IntTy, VTy->getNumElements());
@@ -5132,7 +5132,7 @@
if (const PointerType *PT = Ty->getAs<PointerType>())
return PT->getPointeeType();
- if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType())
+ if (const ObjCObjectPointerType *OPT = Ty->getAs<ObjCObjectPointerType>())
return OPT->getPointeeType();
Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer)
@@ -5735,7 +5735,7 @@
diag::warn_attribute_sentinel_not_variadic) << 1;
// FIXME: remove the attribute.
}
- QualType RetTy = T.getTypePtr()->getAsFunctionType()->getResultType();
+ QualType RetTy = T.getTypePtr()->getAs<FunctionType>()->getResultType();
// Do not allow returning a objc interface by-value.
if (RetTy->isObjCInterfaceType()) {
@@ -5787,7 +5787,7 @@
// Analyze the return type.
QualType T = GetTypeForDeclarator(ParamInfo, CurScope);
- QualType RetTy = T->getAsFunctionType()->getResultType();
+ QualType RetTy = T->getAs<FunctionType>()->getResultType();
// Do not allow returning a objc interface by-value.
if (RetTy->isObjCInterfaceType()) {
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 503e318..b11f397 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -966,7 +966,7 @@
if (StringLiteral *StrLit = dyn_cast<StringLiteral>(From))
if (const PointerType *ToPtrType = ToType->getAs<PointerType>())
if (const BuiltinType *ToPointeeType
- = ToPtrType->getPointeeType()->getAsBuiltinType()) {
+ = ToPtrType->getPointeeType()->getAs<BuiltinType>()) {
// This conversion is considered only when there is an
// explicit appropriate pointer target type (C++ 4.2p2).
if (ToPtrType->getPointeeType().getCVRQualifiers() == 0 &&
@@ -1856,7 +1856,7 @@
if (const PointerType *PT = Ty->getAs<PointerType>())
Ty = PT->getPointeeType();
- const FunctionType *FTy = Ty->getAsFunctionType();
+ const FunctionType *FTy = Ty->getAs<FunctionType>();
if (FTy->getResultType()->isReferenceType())
return Owned(E);
}
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 2616c5c..2023f7b 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -415,7 +415,7 @@
NamedDecl *IDecl = LookupName(TUScope, receiverName, LookupOrdinaryName);
if (TypedefDecl *OCTD = dyn_cast_or_null<TypedefDecl>(IDecl)) {
const ObjCInterfaceType *OCIT;
- OCIT = OCTD->getUnderlyingType()->getAsObjCInterfaceType();
+ OCIT = OCTD->getUnderlyingType()->getAs<ObjCInterfaceType>();
if (!OCIT) {
Diag(receiverLoc, diag::err_invalid_receiver_to_message);
return true;
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 6574524..c430751 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -421,7 +421,7 @@
ElementType = AType->getElementType();
if (const ConstantArrayType *CAType = dyn_cast<ConstantArrayType>(AType))
NumElements = CAType->getSize().getZExtValue();
- } else if (const VectorType *VType = ILE->getType()->getAsVectorType()) {
+ } else if (const VectorType *VType = ILE->getType()->getAs<VectorType>()) {
ElementType = VType->getElementType();
NumElements = VType->getNumElements();
} else
@@ -499,7 +499,7 @@
else if (T->isStructureType() || T->isUnionType())
maxElements = numStructUnionElements(T);
else if (T->isVectorType())
- maxElements = T->getAsVectorType()->getNumElements();
+ maxElements = T->getAs<VectorType>()->getNumElements();
else
assert(0 && "CheckImplicitInitList(): Illegal type");
@@ -835,7 +835,7 @@
InitListExpr *StructuredList,
unsigned &StructuredIndex) {
if (Index < IList->getNumInits()) {
- const VectorType *VT = DeclType->getAsVectorType();
+ const VectorType *VT = DeclType->getAs<VectorType>();
unsigned maxElements = VT->getNumElements();
unsigned numEltsInit = 0;
QualType elementType = VT->getElementType();
@@ -860,7 +860,7 @@
StructuredList, StructuredIndex);
++numEltsInit;
} else {
- const VectorType *IVT = IType->getAsVectorType();
+ const VectorType *IVT = IType->getAs<VectorType>();
unsigned numIElts = IVT->getNumElements();
QualType VecType = SemaRef.Context.getExtVectorType(elementType,
numIElts);
@@ -1625,7 +1625,7 @@
if (NumInits && NumElements > NumInits)
NumElements = 0;
}
- } else if (const VectorType *VType = CurrentObjectType->getAsVectorType())
+ } else if (const VectorType *VType = CurrentObjectType->getAs<VectorType>())
NumElements = VType->getNumElements();
else if (const RecordType *RType = CurrentObjectType->getAs<RecordType>()) {
RecordDecl *RDecl = RType->getDecl();
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 70befd6..44641b7 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -1444,7 +1444,7 @@
// -- If T is a fundamental type, its associated sets of
// namespaces and classes are both empty.
- if (T->getAsBuiltinType())
+ if (T->getAs<BuiltinType>())
return;
// -- If T is a class type (including unions), its associated
@@ -1465,7 +1465,7 @@
// the namespace in which it is defined. If it is class
// member, its associated class is the member’s class; else
// it has no associated class.
- if (const EnumType *EnumT = T->getAsEnumType()) {
+ if (const EnumType *EnumT = T->getAs<EnumType>()) {
EnumDecl *Enum = EnumT->getDecl();
DeclContext *Ctx = Enum->getDeclContext();
@@ -1483,13 +1483,13 @@
// -- If T is a function type, its associated namespaces and
// classes are those associated with the function parameter
// types and those associated with the return type.
- if (const FunctionType *FunctionType = T->getAsFunctionType()) {
+ if (const FunctionType *FnType = T->getAs<FunctionType>()) {
// Return type
- addAssociatedClassesAndNamespaces(FunctionType->getResultType(),
+ addAssociatedClassesAndNamespaces(FnType->getResultType(),
Context,
AssociatedNamespaces, AssociatedClasses);
- const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FunctionType);
+ const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FnType);
if (!Proto)
return;
@@ -1629,7 +1629,7 @@
if (T1->isRecordType() || (!T2.isNull() && T2->isRecordType()))
return true;
- const FunctionProtoType *Proto = Fn->getType()->getAsFunctionProtoType();
+ const FunctionProtoType *Proto = Fn->getType()->getAs<FunctionProtoType>();
if (Proto->getNumArgs() < 1)
return false;
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 33766f9..2ff0c05 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -686,7 +686,7 @@
/// ToType is an integral promotion (C++ 4.5). If so, returns true and
/// sets PromotedType to the promoted type.
bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) {
- const BuiltinType *To = ToType->getAsBuiltinType();
+ const BuiltinType *To = ToType->getAs<BuiltinType>();
// All integers are built-in.
if (!To) {
return false;
@@ -720,7 +720,7 @@
// unsigned.
bool FromIsSigned;
uint64_t FromSize = Context.getTypeSize(FromType);
- if (const EnumType *FromEnumType = FromType->getAsEnumType()) {
+ if (const EnumType *FromEnumType = FromType->getAs<EnumType>()) {
QualType UnderlyingType = FromEnumType->getDecl()->getIntegerType();
FromIsSigned = UnderlyingType->isSignedIntegerType();
} else {
@@ -798,8 +798,8 @@
bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType) {
/// An rvalue of type float can be converted to an rvalue of type
/// double. (C++ 4.6p1).
- if (const BuiltinType *FromBuiltin = FromType->getAsBuiltinType())
- if (const BuiltinType *ToBuiltin = ToType->getAsBuiltinType()) {
+ if (const BuiltinType *FromBuiltin = FromType->getAs<BuiltinType>())
+ if (const BuiltinType *ToBuiltin = ToType->getAs<BuiltinType>()) {
if (FromBuiltin->getKind() == BuiltinType::Float &&
ToBuiltin->getKind() == BuiltinType::Double)
return true;
@@ -823,11 +823,11 @@
/// where the conversion between the underlying real types is a
/// floating-point or integral promotion.
bool Sema::IsComplexPromotion(QualType FromType, QualType ToType) {
- const ComplexType *FromComplex = FromType->getAsComplexType();
+ const ComplexType *FromComplex = FromType->getAs<ComplexType>();
if (!FromComplex)
return false;
- const ComplexType *ToComplex = ToType->getAsComplexType();
+ const ComplexType *ToComplex = ToType->getAs<ComplexType>();
if (!ToComplex)
return false;
@@ -1003,9 +1003,9 @@
return false;
// First, we handle all conversions on ObjC object pointer types.
- const ObjCObjectPointerType* ToObjCPtr = ToType->getAsObjCObjectPointerType();
+ const ObjCObjectPointerType* ToObjCPtr = ToType->getAs<ObjCObjectPointerType>();
const ObjCObjectPointerType *FromObjCPtr =
- FromType->getAsObjCObjectPointerType();
+ FromType->getAs<ObjCObjectPointerType>();
if (ToObjCPtr && FromObjCPtr) {
// Objective C++: We're able to convert between "id" or "Class" and a
@@ -1070,9 +1070,9 @@
// pointer conversions. If so, we permit the conversion (but
// complain about it).
const FunctionProtoType *FromFunctionType
- = FromPointeeType->getAsFunctionProtoType();
+ = FromPointeeType->getAs<FunctionProtoType>();
const FunctionProtoType *ToFunctionType
- = ToPointeeType->getAsFunctionProtoType();
+ = ToPointeeType->getAs<FunctionProtoType>();
if (FromFunctionType && ToFunctionType) {
// If the function types are exactly the same, this isn't an
// Objective-C pointer conversion.
@@ -1160,9 +1160,9 @@
}
}
if (const ObjCObjectPointerType *FromPtrType =
- FromType->getAsObjCObjectPointerType())
+ FromType->getAs<ObjCObjectPointerType>())
if (const ObjCObjectPointerType *ToPtrType =
- ToType->getAsObjCObjectPointerType()) {
+ ToType->getAs<ObjCObjectPointerType>()) {
// Objective-C++ conversions are always okay.
// FIXME: We should have a different class of conversions for the
// Objective-C++ implicit conversions.
@@ -1644,8 +1644,8 @@
// Objective-C++: If one interface is more specific than the
// other, it is the better one.
- const ObjCInterfaceType* FromIface1 = FromPointee1->getAsObjCInterfaceType();
- const ObjCInterfaceType* FromIface2 = FromPointee2->getAsObjCInterfaceType();
+ const ObjCInterfaceType* FromIface1 = FromPointee1->getAs<ObjCInterfaceType>();
+ const ObjCInterfaceType* FromIface2 = FromPointee2->getAs<ObjCInterfaceType>();
if (FromIface1 && FromIface1) {
if (Context.canAssignObjCInterfaces(FromIface2, FromIface1))
return ImplicitConversionSequence::Better;
@@ -1832,10 +1832,10 @@
QualType ToPointee2
= ToType2->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
- const ObjCInterfaceType* FromIface1 = FromPointee1->getAsObjCInterfaceType();
- const ObjCInterfaceType* FromIface2 = FromPointee2->getAsObjCInterfaceType();
- const ObjCInterfaceType* ToIface1 = ToPointee1->getAsObjCInterfaceType();
- const ObjCInterfaceType* ToIface2 = ToPointee2->getAsObjCInterfaceType();
+ const ObjCInterfaceType* FromIface1 = FromPointee1->getAs<ObjCInterfaceType>();
+ const ObjCInterfaceType* FromIface2 = FromPointee2->getAs<ObjCInterfaceType>();
+ const ObjCInterfaceType* ToIface1 = ToPointee1->getAs<ObjCInterfaceType>();
+ const ObjCInterfaceType* ToIface2 = ToPointee2->getAs<ObjCInterfaceType>();
// -- conversion of C* to B* is better than conversion of C* to A*,
if (FromPointee1 == FromPointee2 && ToPointee1 != ToPointee2) {
@@ -2129,7 +2129,7 @@
bool SuppressUserConversions,
bool ForceRValue) {
const FunctionProtoType* Proto
- = dyn_cast<FunctionProtoType>(Function->getType()->getAsFunctionType());
+ = dyn_cast<FunctionProtoType>(Function->getType()->getAs<FunctionType>());
assert(Proto && "Functions without a prototype cannot be overloaded");
assert(!isa<CXXConversionDecl>(Function) &&
"Use AddConversionCandidate for conversion functions");
@@ -2247,7 +2247,7 @@
OverloadCandidateSet& CandidateSet,
bool SuppressUserConversions, bool ForceRValue) {
const FunctionProtoType* Proto
- = dyn_cast<FunctionProtoType>(Method->getType()->getAsFunctionType());
+ = dyn_cast<FunctionProtoType>(Method->getType()->getAs<FunctionType>());
assert(Proto && "Methods without a prototype cannot be overloaded");
assert(!isa<CXXConversionDecl>(Method) &&
"Use AddConversionCandidate for conversion functions");
@@ -3865,7 +3865,7 @@
isPointer = true;
}
// Desugar down to a function type.
- FnType = QualType(FnType->getAsFunctionType(), 0);
+ FnType = QualType(FnType->getAs<FunctionType>(), 0);
// Reconstruct the pointer/reference as appropriate.
if (isPointer) FnType = Context.getPointerType(FnType);
if (isRValueReference) FnType = Context.getRValueReferenceType(FnType);
@@ -4318,7 +4318,7 @@
// Determine the result type
QualType ResultTy
- = FnDecl->getType()->getAsFunctionType()->getResultType();
+ = FnDecl->getType()->getAs<FunctionType>()->getResultType();
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
@@ -4476,7 +4476,7 @@
// Determine the result type
QualType ResultTy
- = FnDecl->getType()->getAsFunctionType()->getResultType();
+ = FnDecl->getType()->getAs<FunctionType>()->getResultType();
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
@@ -4714,7 +4714,7 @@
if (const PointerType *ConvPtrType = ConvType->getAs<PointerType>())
ConvType = ConvPtrType->getPointeeType();
- if (const FunctionProtoType *Proto = ConvType->getAsFunctionProtoType())
+ if (const FunctionProtoType *Proto = ConvType->getAs<FunctionProtoType>())
AddSurrogateCandidate(Conv, Proto, Object, Args, NumArgs, CandidateSet);
}
}
@@ -4783,7 +4783,7 @@
// that calls this method, using Object for the implicit object
// parameter and passing along the remaining arguments.
CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function);
- const FunctionProtoType *Proto = Method->getType()->getAsFunctionProtoType();
+ const FunctionProtoType *Proto = Method->getType()->getAs<FunctionProtoType>();
unsigned NumArgsInProto = Proto->getNumArgs();
unsigned NumArgsToCheck = NumArgs;
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index e6597f5..97b5b52 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -1625,7 +1625,7 @@
//
// FIXME: Perform the recursive and no-linkage type checks.
const TagType *Tag = 0;
- if (const EnumType *EnumT = Arg->getAsEnumType())
+ if (const EnumType *EnumT = Arg->getAs<EnumType>())
Tag = EnumT;
else if (const RecordType *RecordT = Arg->getAs<RecordType>())
Tag = RecordT;
@@ -1890,7 +1890,7 @@
}
QualType IntegerType = Context.getCanonicalType(ParamType);
- if (const EnumType *Enum = IntegerType->getAsEnumType())
+ if (const EnumType *Enum = IntegerType->getAs<EnumType>())
IntegerType = Context.getCanonicalType(Enum->getDecl()->getIntegerType());
if (!Arg->isValueDependent()) {
@@ -3209,7 +3209,7 @@
NestedNameSpecifier *NNS
= static_cast<NestedNameSpecifier *>(SS.getScopeRep());
const TemplateSpecializationType *TemplateId
- = T->getAsTemplateSpecializationType();
+ = T->getAs<TemplateSpecializationType>();
assert(TemplateId && "Expected a template specialization type");
if (computeDeclContext(SS, false)) {
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 5a5d63e..8d4999b 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -410,7 +410,7 @@
// T
// cv-list T
if (const TemplateTypeParmType *TemplateTypeParm
- = Param->getAsTemplateTypeParmType()) {
+ = Param->getAs<TemplateTypeParmType>()) {
unsigned Index = TemplateTypeParm->getIndex();
bool RecanonicalizeArg = false;
@@ -1040,7 +1040,7 @@
/// \brief Determine whether the given type T is a simple-template-id type.
static bool isSimpleTemplateIdType(QualType T) {
if (const TemplateSpecializationType *Spec
- = T->getAsTemplateSpecializationType())
+ = T->getAs<TemplateSpecializationType>())
return Spec->getTemplateName().getAsTemplateDecl() != 0;
return false;
@@ -1157,7 +1157,7 @@
if (FunctionType) {
// FIXME: exception-specifications?
const FunctionProtoType *Proto
- = Function->getType()->getAsFunctionProtoType();
+ = Function->getType()->getAs<FunctionProtoType>();
assert(Proto && "Function template does not have a prototype?");
QualType ResultType
@@ -1310,7 +1310,7 @@
return TDK_TooFewArguments;
else if (NumArgs > Function->getNumParams()) {
const FunctionProtoType *Proto
- = Function->getType()->getAsFunctionProtoType();
+ = Function->getType()->getAs<FunctionProtoType>();
if (!Proto->isVariadic())
return TDK_TooManyArguments;
@@ -1384,7 +1384,7 @@
// the argument is an lvalue, the type A& is used in place of A for
// type deduction.
if (isa<RValueReferenceType>(ParamRefType) &&
- ParamRefType->getAsTemplateTypeParmType() &&
+ ParamRefType->getAs<TemplateTypeParmType>() &&
Args[I]->isLvalue(Context) == Expr::LV_Valid)
ArgType = Context.getLValueReferenceType(ArgType);
}
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index a43413e..0564cbe 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -592,7 +592,7 @@
} else if (CXXConversionDecl *Conversion = dyn_cast<CXXConversionDecl>(D)) {
CanQualType ConvTy
= SemaRef.Context.getCanonicalType(
- T->getAsFunctionType()->getResultType());
+ T->getAs<FunctionType>()->getResultType());
Name = SemaRef.Context.DeclarationNames.getCXXConversionFunctionName(
ConvTy);
Method = CXXConversionDecl::Create(SemaRef.Context, Record,
@@ -867,7 +867,7 @@
if (InvalidDecl)
return QualType();
- const FunctionProtoType *Proto = D->getType()->getAsFunctionProtoType();
+ const FunctionProtoType *Proto = D->getType()->getAs<FunctionProtoType>();
assert(Proto && "Missing prototype?");
QualType ResultType
= SemaRef.SubstType(Proto->getResultType(), TemplateArgs,
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index a56e1ae..6fee787 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -214,7 +214,7 @@
Result = GetTypeFromParser(DS.getTypeRep());
if (DeclSpec::ProtocolQualifierListTy PQ = DS.getProtocolQualifiers()) {
- if (const ObjCInterfaceType *Interface = Result->getAsObjCInterfaceType())
+ if (const ObjCInterfaceType *Interface = Result->getAs<ObjCInterfaceType>())
// It would be nice if protocol qualifiers were only stored with the
// ObjCObjectPointerType. Unfortunately, this isn't possible due
// to the following typedef idiom (which is uncommon, but allowed):
@@ -949,7 +949,7 @@
// Build the type anyway.
}
if (getLangOptions().ObjC1 && T->isObjCInterfaceType()) {
- const ObjCInterfaceType *OIT = T->getAsObjCInterfaceType();
+ const ObjCInterfaceType *OIT = T->getAs<ObjCInterfaceType>();
T = Context.getObjCObjectPointerType(T,
(ObjCProtocolDecl **)OIT->qual_begin(),
OIT->getNumProtocols());
@@ -1141,7 +1141,7 @@
} else if (!FTI.hasPrototype) {
if (ArgTy->isPromotableIntegerType()) {
ArgTy = Context.getPromotedIntegerType(ArgTy);
- } else if (const BuiltinType* BTy = ArgTy->getAsBuiltinType()) {
+ } else if (const BuiltinType* BTy = ArgTy->getAs<BuiltinType>()) {
if (BTy->getKind() == BuiltinType::Float)
ArgTy = Context.DoubleTy;
}
@@ -1223,7 +1223,7 @@
}
if (getLangOptions().CPlusPlus && T->isFunctionType()) {
- const FunctionProtoType *FnTy = T->getAsFunctionProtoType();
+ const FunctionProtoType *FnTy = T->getAs<FunctionProtoType>();
assert(FnTy && "Why oh why is there not a FunctionProtoType here ?");
// C++ 8.3.5p4: A cv-qualifier-seq shall only be part of the function type
@@ -1400,7 +1400,7 @@
else
return false;
- const FunctionProtoType *FnT = T->getAsFunctionProtoType();
+ const FunctionProtoType *FnT = T->getAs<FunctionProtoType>();
if (!FnT)
return false;
@@ -1816,7 +1816,7 @@
const TagType *Tag = 0;
if (const RecordType *Record = T->getAs<RecordType>())
Tag = Record;
- else if (const EnumType *Enum = T->getAsEnumType())
+ else if (const EnumType *Enum = T->getAs<EnumType>())
Tag = Enum;
if (Tag && !Tag->getDecl()->isInvalidDecl())