summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaInit.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 9003a87cc81..00b7e9b1c0f 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -974,7 +974,7 @@ int InitListChecker::numArrayElements(QualType DeclType) {
}
int InitListChecker::numStructUnionElements(QualType DeclType) {
- RecordDecl *structDecl = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *structDecl = DeclType->castAs<RecordType>()->getDecl();
int InitializableMembers = 0;
if (auto *CXXRD = dyn_cast<CXXRecordDecl>(structDecl))
InitializableMembers += CXXRD->getNumBases();
@@ -1033,7 +1033,7 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity,
else if (T->isRecordType())
maxElements = numStructUnionElements(T);
else if (T->isVectorType())
- maxElements = T->getAs<VectorType>()->getNumElements();
+ maxElements = T->castAs<VectorType>()->getNumElements();
else
llvm_unreachable("CheckImplicitInitList(): Illegal type");
@@ -1264,7 +1264,7 @@ void InitListChecker::CheckListElementTypes(const InitializedEntity &Entity,
} else if (DeclType->isRecordType()) {
assert(DeclType->isAggregateType() &&
"non-aggregate records should be handed in CheckSubElementType");
- RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = DeclType->castAs<RecordType>()->getDecl();
auto Bases =
CXXRecordDecl::base_class_range(CXXRecordDecl::base_class_iterator(),
CXXRecordDecl::base_class_iterator());
@@ -1490,7 +1490,7 @@ void InitListChecker::CheckComplexType(const InitializedEntity &Entity,
<< IList->getSourceRange();
// Initialize the complex number.
- QualType elementType = DeclType->getAs<ComplexType>()->getElementType();
+ QualType elementType = DeclType->castAs<ComplexType>()->getElementType();
InitializedEntity ElementEntity =
InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity);
@@ -1636,7 +1636,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
unsigned &Index,
InitListExpr *StructuredList,
unsigned &StructuredIndex) {
- const VectorType *VT = DeclType->getAs<VectorType>();
+ const VectorType *VT = DeclType->castAs<VectorType>();
unsigned maxElements = VT->getNumElements();
unsigned numEltsInit = 0;
QualType elementType = VT->getElementType();
@@ -1706,7 +1706,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
return;
bool isBigEndian = SemaRef.Context.getTargetInfo().isBigEndian();
- const VectorType *T = Entity.getType()->getAs<VectorType>();
+ const VectorType *T = Entity.getType()->castAs<VectorType>();
if (isBigEndian && (T->getVectorKind() == VectorType::NeonVector ||
T->getVectorKind() == VectorType::NeonPolyVector)) {
// The ability to use vector initializer lists is a GNU vector extension
@@ -1762,7 +1762,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
++numEltsInit;
} else {
QualType VecType;
- const VectorType *IVT = IType->getAs<VectorType>();
+ const VectorType *IVT = IType->castAs<VectorType>();
unsigned numIElts = IVT->getNumElements();
if (IType->isExtVectorType())
@@ -1995,7 +1995,7 @@ void InitListChecker::CheckStructUnionTypes(
bool SubobjectIsDesignatorContext, unsigned &Index,
InitListExpr *StructuredList, unsigned &StructuredIndex,
bool TopLevelObject) {
- RecordDecl *structDecl = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *structDecl = DeclType->castAs<RecordType>()->getDecl();
// If the record is invalid, some of it's members are invalid. To avoid
// confusion, we forgo checking the intializer for the entire record.
@@ -2007,7 +2007,7 @@ void InitListChecker::CheckStructUnionTypes(
}
if (DeclType->isUnionType() && IList->getNumInits() == 0) {
- RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = DeclType->castAs<RecordType>()->getDecl();
if (!VerifyOnly)
for (FieldDecl *FD : RD->fields()) {
@@ -2082,7 +2082,7 @@ void InitListChecker::CheckStructUnionTypes(
// anything except look at designated initializers; That's okay,
// because an error should get printed out elsewhere. It might be
// worthwhile to skip over the rest of the initializer, though.
- RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = DeclType->castAs<RecordType>()->getDecl();
RecordDecl::field_iterator FieldEnd = RD->field_end();
bool CheckForMissingFields =
!IList->isIdiomaticZeroInitializer(SemaRef.getLangOpts());
@@ -4206,7 +4206,7 @@ static void TryReferenceListInitialization(Sema &S,
}
QualType DestType = Entity.getType();
- QualType cv1T1 = DestType->getAs<ReferenceType>()->getPointeeType();
+ QualType cv1T1 = DestType->castAs<ReferenceType>()->getPointeeType();
Qualifiers T1Quals;
QualType T1 = S.Context.getUnqualifiedArrayType(cv1T1, T1Quals);
@@ -4463,7 +4463,7 @@ static OverloadingResult TryRefInitWithConversionFunction(
Expr *Initializer, bool AllowRValues, bool IsLValueRef,
InitializationSequence &Sequence) {
QualType DestType = Entity.getType();
- QualType cv1T1 = DestType->getAs<ReferenceType>()->getPointeeType();
+ QualType cv1T1 = DestType->castAs<ReferenceType>()->getPointeeType();
QualType T1 = cv1T1.getUnqualifiedType();
QualType cv2T2 = Initializer->getType();
QualType T2 = cv2T2.getUnqualifiedType();
@@ -4656,7 +4656,7 @@ static void TryReferenceInitialization(Sema &S,
Expr *Initializer,
InitializationSequence &Sequence) {
QualType DestType = Entity.getType();
- QualType cv1T1 = DestType->getAs<ReferenceType>()->getPointeeType();
+ QualType cv1T1 = DestType->castAs<ReferenceType>()->getPointeeType();
Qualifiers T1Quals;
QualType T1 = S.Context.getUnqualifiedArrayType(cv1T1, T1Quals);
QualType cv2T2 = Initializer->getType();
@@ -8201,7 +8201,7 @@ ExprResult InitializationSequence::Perform(Sema &S,
Ty = S.Context.getRValueReferenceType(Ty);
else if ((*ResultType)->isLValueReferenceType())
Ty = S.Context.getLValueReferenceType(Ty,
- (*ResultType)->getAs<LValueReferenceType>()->isSpelledAsLValue());
+ (*ResultType)->castAs<LValueReferenceType>()->isSpelledAsLValue());
*ResultType = Ty;
}
@@ -8659,7 +8659,7 @@ static void diagnoseListInit(Sema &S, const InitializedEntity &Entity,
// A list-initialization failure for a reference means that we tried to
// create a temporary of the inner type (per [dcl.init.list]p3.6) and the
// inner initialization failed.
- QualType T = DestType->getAs<ReferenceType>()->getPointeeType();
+ QualType T = DestType->castAs<ReferenceType>()->getPointeeType();
diagnoseListInit(S, InitializedEntity::InitializeTemporary(T), InitList);
SourceLocation Loc = InitList->getBeginLoc();
if (auto *D = Entity.getDecl())
@@ -9016,7 +9016,7 @@ bool InitializationSequence::Diagnose(Sema &S,
<< InheritedFrom;
RecordDecl *BaseDecl
- = Entity.getBaseSpecifier()->getType()->getAs<RecordType>()
+ = Entity.getBaseSpecifier()->getType()->castAs<RecordType>()
->getDecl();
S.Diag(BaseDecl->getLocation(), diag::note_previous_decl)
<< S.Context.getTagDeclType(BaseDecl);
OpenPOWER on IntegriCloud