Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76132 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 21daa8f..d533e63 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1751,7 +1751,7 @@
// virtual function that overrides a virtual function in a base class.
QualType ClassType
= Context.getCanonicalType(Context.getTypeDeclType(ClassDecl));
- if (const ReferenceType *ConvTypeRef = ConvType->getAsReferenceType())
+ if (const ReferenceType *ConvTypeRef = ConvType->getAs<ReferenceType>())
ConvType = ConvTypeRef->getPointeeType();
if (ConvType->isRecordType()) {
ConvType = Context.getCanonicalType(ConvType).getUnqualifiedType();
@@ -2548,7 +2548,7 @@
bool AllowExplicit, bool ForceRValue) {
assert(DeclType->isReferenceType() && "Reference init needs a reference");
- QualType T1 = DeclType->getAsReferenceType()->getPointeeType();
+ QualType T1 = DeclType->getAs<ReferenceType>()->getPointeeType();
QualType T2 = Init->getType();
// If the initializer is the address of an overloaded function, try
@@ -3083,7 +3083,7 @@
BaseType = Ptr->getPointeeType();
Mode = 1;
DK = diag::err_catch_incomplete_ptr;
- } else if(const ReferenceType *Ref = BaseType->getAsReferenceType()) {
+ } else if(const ReferenceType *Ref = BaseType->getAs<ReferenceType>()) {
// For the purpose of error recovery, we treat rvalue refs like lvalue refs.
BaseType = Ref->getPointeeType();
Mode = 2;
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index a229791..da5e6ba 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1073,7 +1073,7 @@
Ctx = FD->getDeclContext();
MemberType = FD->getType();
- if (const ReferenceType *RefType = MemberType->getAsReferenceType())
+ if (const ReferenceType *RefType = MemberType->getAs<ReferenceType>())
MemberType = RefType->getPointeeType();
else if (!FD->isMutable()) {
unsigned combinedQualifiers
@@ -2177,7 +2177,7 @@
// Figure out the type of the member; see C99 6.5.2.3p3, C++ [expr.ref]
// FIXME: Handle address space modifiers
QualType MemberType = FD->getType();
- if (const ReferenceType *Ref = MemberType->getAsReferenceType())
+ if (const ReferenceType *Ref = MemberType->getAs<ReferenceType>())
MemberType = Ref->getPointeeType();
else {
unsigned combinedQualifiers =
@@ -3447,7 +3447,7 @@
// right-hand side type. The caller is responsible for adjusting
// lhsType so that the resulting expression does not have reference
// type.
- if (const ReferenceType *lhsTypeRef = lhsType->getAsReferenceType()) {
+ if (const ReferenceType *lhsTypeRef = lhsType->getAs<ReferenceType>()) {
if (Context.typesAreCompatible(lhsTypeRef->getPointeeType(), rhsType))
return Compatible;
return Incompatible;
diff --git a/lib/Sema/SemaNamedCast.cpp b/lib/Sema/SemaNamedCast.cpp
index 4b58b3d..1fdbcfe 100644
--- a/lib/Sema/SemaNamedCast.cpp
+++ b/lib/Sema/SemaNamedCast.cpp
@@ -604,7 +604,7 @@
return TSC_NotApplicable;
}
- const ReferenceType *DestReference = DestType->getAsReferenceType();
+ const ReferenceType *DestReference = DestType->getAs<ReferenceType>();
if (!DestReference) {
return TSC_NotApplicable;
}
@@ -829,7 +829,7 @@
QualType DestPointee;
const PointerType *DestPointer = DestType->getAs<PointerType>();
- const ReferenceType *DestReference = DestType->getAsReferenceType();
+ const ReferenceType *DestReference = DestType->getAs<ReferenceType>();
if (DestPointer) {
DestPointee = DestPointer->getPointeeType();
} else if (DestReference) {
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index dc24a03..aef7f18 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -2704,7 +2704,7 @@
// Look through reference types; they aren't part of the type of an
// expression for the purposes of conversions.
- if (const ReferenceType *RefTy = Ty->getAsReferenceType())
+ if (const ReferenceType *RefTy = Ty->getAs<ReferenceType>())
Ty = RefTy->getPointeeType();
// We don't care about qualifiers on the type.
@@ -3675,7 +3675,7 @@
bool IsMember = false;
if (const PointerType *ToTypePtr = ToType->getAs<PointerType>())
FunctionType = ToTypePtr->getPointeeType();
- else if (const ReferenceType *ToTypeRef = ToType->getAsReferenceType())
+ else if (const ReferenceType *ToTypeRef = ToType->getAs<ReferenceType>())
FunctionType = ToTypeRef->getPointeeType();
else if (const MemberPointerType *MemTypePtr =
ToType->getAsMemberPointerType()) {
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 85d3867..9159cf1 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -1654,7 +1654,7 @@
// represents a set of overloaded functions, the matching
// function is selected from the set (13.4).
(ParamType->isReferenceType() &&
- ParamType->getAsReferenceType()->getPointeeType()->isFunctionType()) ||
+ ParamType->getAs<ReferenceType>()->getPointeeType()->isFunctionType()) ||
// -- For a non-type template-parameter of type pointer to
// member function, no conversions apply. If the
// template-argument represents a set of overloaded member
@@ -1755,7 +1755,7 @@
return false;
}
- if (const ReferenceType *ParamRefType = ParamType->getAsReferenceType()) {
+ if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
// -- For a non-type template-parameter of type reference to
// object, no conversions apply. The type referred to by the
// reference may be more cv-qualified than the (otherwise
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index b304751..d475538 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -1282,7 +1282,7 @@
// are ignored for type deduction.
if (CanonParamType.getCVRQualifiers())
ParamType = CanonParamType.getUnqualifiedType();
- if (const ReferenceType *ParamRefType = ParamType->getAsReferenceType()) {
+ if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
// [...] If P is a reference type, the type referred to by P is used
// for type deduction.
ParamType = ParamRefType->getPointeeType();
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index ee4cd20..d69227c 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -301,7 +301,7 @@
if (Result->isPointerType() || Result->isReferenceType()) {
QualType EltTy = Result->isPointerType() ?
Result->getAs<PointerType>()->getPointeeType() :
- Result->getAsReferenceType()->getPointeeType();
+ Result->getAs<ReferenceType>()->getPointeeType();
// If we have a pointer or reference, the pointee must have an object
// incomplete type.
@@ -1188,7 +1188,7 @@
if (const PointerType* IT = T->getAs<PointerType>()) {
T = IT->getPointeeType();
kind = 1;
- } else if (const ReferenceType* IT = T->getAsReferenceType()) {
+ } else if (const ReferenceType* IT = T->getAs<ReferenceType>()) {
T = IT->getPointeeType();
kind = 2;
} else
@@ -1285,7 +1285,7 @@
// Take one type from the subset.
QualType CanonicalSubT = Context.getCanonicalType(*SubI);
bool SubIsPointer = false;
- if (const ReferenceType *RefTy = CanonicalSubT->getAsReferenceType())
+ if (const ReferenceType *RefTy = CanonicalSubT->getAs<ReferenceType>())
CanonicalSubT = RefTy->getPointeeType();
if (const PointerType *PtrTy = CanonicalSubT->getAs<PointerType>()) {
CanonicalSubT = PtrTy->getPointeeType();
@@ -1305,7 +1305,7 @@
QualType CanonicalSuperT = Context.getCanonicalType(*SuperI);
// SubT must be SuperT or derived from it, or pointer or reference to
// such types.
- if (const ReferenceType *RefTy = CanonicalSuperT->getAsReferenceType())
+ if (const ReferenceType *RefTy = CanonicalSuperT->getAs<ReferenceType>())
CanonicalSuperT = RefTy->getPointeeType();
if (SubIsPointer) {
if (const PointerType *PtrTy = CanonicalSuperT->getAs<PointerType>())