|
@@ -833,8 +833,8 @@ static void CheckConstexprCtorInitializer(Sema &SemaRef,
|
|
I != E; ++I)
|
|
I != E; ++I)
|
|
// If an anonymous union contains an anonymous struct of which any member
|
|
// If an anonymous union contains an anonymous struct of which any member
|
|
// is initialized, all members must be initialized.
|
|
// is initialized, all members must be initialized.
|
|
- if (!RD->isUnion() || Inits.count(*I))
|
|
|
|
- CheckConstexprCtorInitializer(SemaRef, Dcl, *I, Inits, Diagnosed);
|
|
|
|
|
|
+ if (!RD->isUnion() || Inits.count(&*I))
|
|
|
|
+ CheckConstexprCtorInitializer(SemaRef, Dcl, &*I, Inits, Diagnosed);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -920,7 +920,7 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) {
|
|
unsigned Fields = 0;
|
|
unsigned Fields = 0;
|
|
for (CXXRecordDecl::field_iterator I = RD->field_begin(),
|
|
for (CXXRecordDecl::field_iterator I = RD->field_begin(),
|
|
E = RD->field_end(); I != E; ++I, ++Fields) {
|
|
E = RD->field_end(); I != E; ++I, ++Fields) {
|
|
- if ((*I)->isAnonymousStructOrUnion()) {
|
|
|
|
|
|
+ if (I->isAnonymousStructOrUnion()) {
|
|
AnyAnonStructUnionMembers = true;
|
|
AnyAnonStructUnionMembers = true;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -943,7 +943,7 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) {
|
|
bool Diagnosed = false;
|
|
bool Diagnosed = false;
|
|
for (CXXRecordDecl::field_iterator I = RD->field_begin(),
|
|
for (CXXRecordDecl::field_iterator I = RD->field_begin(),
|
|
E = RD->field_end(); I != E; ++I)
|
|
E = RD->field_end(); I != E; ++I)
|
|
- CheckConstexprCtorInitializer(*this, Dcl, *I, Inits, Diagnosed);
|
|
|
|
|
|
+ CheckConstexprCtorInitializer(*this, Dcl, &*I, Inits, Diagnosed);
|
|
if (Diagnosed)
|
|
if (Diagnosed)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -3089,7 +3089,7 @@ DiagnoseBaseOrMemInitializerOrder(Sema &SemaRef,
|
|
if (Field->isUnnamedBitfield())
|
|
if (Field->isUnnamedBitfield())
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- IdealInitKeys.push_back(GetKeyForTopLevelField(*Field));
|
|
|
|
|
|
+ IdealInitKeys.push_back(GetKeyForTopLevelField(&*Field));
|
|
}
|
|
}
|
|
|
|
|
|
unsigned NumIdealInits = IdealInitKeys.size();
|
|
unsigned NumIdealInits = IdealInitKeys.size();
|
|
@@ -3289,7 +3289,7 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
|
|
// Non-static data members.
|
|
// Non-static data members.
|
|
for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(),
|
|
for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(),
|
|
E = ClassDecl->field_end(); I != E; ++I) {
|
|
E = ClassDecl->field_end(); I != E; ++I) {
|
|
- FieldDecl *Field = *I;
|
|
|
|
|
|
+ FieldDecl *Field = &*I;
|
|
if (Field->isInvalidDecl())
|
|
if (Field->isInvalidDecl())
|
|
continue;
|
|
continue;
|
|
|
|
|
|
@@ -3732,8 +3732,8 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
|
|
for (CXXRecordDecl::method_iterator M = Record->method_begin(),
|
|
for (CXXRecordDecl::method_iterator M = Record->method_begin(),
|
|
MEnd = Record->method_end();
|
|
MEnd = Record->method_end();
|
|
M != MEnd; ++M) {
|
|
M != MEnd; ++M) {
|
|
- if (!(*M)->isStatic())
|
|
|
|
- DiagnoseHiddenVirtualMethods(Record, *M);
|
|
|
|
|
|
+ if (!M->isStatic())
|
|
|
|
+ DiagnoseHiddenVirtualMethods(Record, &*M);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3762,7 +3762,7 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
|
|
|
|
|
|
case TSK_Undeclared:
|
|
case TSK_Undeclared:
|
|
case TSK_ExplicitSpecialization:
|
|
case TSK_ExplicitSpecialization:
|
|
- RequireLiteralType((*M)->getLocation(), Context.getRecordType(Record),
|
|
|
|
|
|
+ RequireLiteralType(M->getLocation(), Context.getRecordType(Record),
|
|
PDiag(diag::err_constexpr_method_non_literal));
|
|
PDiag(diag::err_constexpr_method_non_literal));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -3791,30 +3791,30 @@ void Sema::CheckExplicitlyDefaultedMethods(CXXRecordDecl *Record) {
|
|
ME = Record->method_end();
|
|
ME = Record->method_end();
|
|
MI != ME; ++MI) {
|
|
MI != ME; ++MI) {
|
|
if (!MI->isInvalidDecl() && MI->isExplicitlyDefaulted()) {
|
|
if (!MI->isInvalidDecl() && MI->isExplicitlyDefaulted()) {
|
|
- switch (getSpecialMember(*MI)) {
|
|
|
|
|
|
+ switch (getSpecialMember(&*MI)) {
|
|
case CXXDefaultConstructor:
|
|
case CXXDefaultConstructor:
|
|
CheckExplicitlyDefaultedDefaultConstructor(
|
|
CheckExplicitlyDefaultedDefaultConstructor(
|
|
- cast<CXXConstructorDecl>(*MI));
|
|
|
|
|
|
+ cast<CXXConstructorDecl>(&*MI));
|
|
break;
|
|
break;
|
|
|
|
|
|
case CXXDestructor:
|
|
case CXXDestructor:
|
|
- CheckExplicitlyDefaultedDestructor(cast<CXXDestructorDecl>(*MI));
|
|
|
|
|
|
+ CheckExplicitlyDefaultedDestructor(cast<CXXDestructorDecl>(&*MI));
|
|
break;
|
|
break;
|
|
|
|
|
|
case CXXCopyConstructor:
|
|
case CXXCopyConstructor:
|
|
- CheckExplicitlyDefaultedCopyConstructor(cast<CXXConstructorDecl>(*MI));
|
|
|
|
|
|
+ CheckExplicitlyDefaultedCopyConstructor(cast<CXXConstructorDecl>(&*MI));
|
|
break;
|
|
break;
|
|
|
|
|
|
case CXXCopyAssignment:
|
|
case CXXCopyAssignment:
|
|
- CheckExplicitlyDefaultedCopyAssignment(*MI);
|
|
|
|
|
|
+ CheckExplicitlyDefaultedCopyAssignment(&*MI);
|
|
break;
|
|
break;
|
|
|
|
|
|
case CXXMoveConstructor:
|
|
case CXXMoveConstructor:
|
|
- CheckExplicitlyDefaultedMoveConstructor(cast<CXXConstructorDecl>(*MI));
|
|
|
|
|
|
+ CheckExplicitlyDefaultedMoveConstructor(cast<CXXConstructorDecl>(&*MI));
|
|
break;
|
|
break;
|
|
|
|
|
|
case CXXMoveAssignment:
|
|
case CXXMoveAssignment:
|
|
- CheckExplicitlyDefaultedMoveAssignment(*MI);
|
|
|
|
|
|
+ CheckExplicitlyDefaultedMoveAssignment(&*MI);
|
|
break;
|
|
break;
|
|
|
|
|
|
case CXXInvalid:
|
|
case CXXInvalid:
|
|
@@ -4599,7 +4599,7 @@ bool SpecialMemberDeletionInfo::shouldDeleteForField(FieldDecl *FD) {
|
|
|
|
|
|
CXXRecordDecl *UnionFieldRecord = UnionFieldType->getAsCXXRecordDecl();
|
|
CXXRecordDecl *UnionFieldRecord = UnionFieldType->getAsCXXRecordDecl();
|
|
if (UnionFieldRecord &&
|
|
if (UnionFieldRecord &&
|
|
- shouldDeleteForClassSubobject(UnionFieldRecord, *UI))
|
|
|
|
|
|
+ shouldDeleteForClassSubobject(UnionFieldRecord, &*UI))
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4736,7 +4736,7 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
|
|
for (CXXRecordDecl::field_iterator FI = RD->field_begin(),
|
|
for (CXXRecordDecl::field_iterator FI = RD->field_begin(),
|
|
FE = RD->field_end(); FI != FE; ++FI)
|
|
FE = RD->field_end(); FI != FE; ++FI)
|
|
if (!FI->isInvalidDecl() && !FI->isUnnamedBitfield() &&
|
|
if (!FI->isInvalidDecl() && !FI->isUnnamedBitfield() &&
|
|
- SMI.shouldDeleteForField(*FI))
|
|
|
|
|
|
+ SMI.shouldDeleteForField(&*FI))
|
|
return true;
|
|
return true;
|
|
|
|
|
|
if (SMI.shouldDeleteForAllConstMembers())
|
|
if (SMI.shouldDeleteForAllConstMembers())
|
|
@@ -7088,7 +7088,7 @@ void Sema::DeclareInheritedConstructors(CXXRecordDecl *ClassDecl) {
|
|
// results from omitting any ellipsis parameter specification and
|
|
// results from omitting any ellipsis parameter specification and
|
|
// successively omitting parameters with a default argument from the
|
|
// successively omitting parameters with a default argument from the
|
|
// end of the parameter-type-list.
|
|
// end of the parameter-type-list.
|
|
- CXXConstructorDecl *BaseCtor = *CtorIt;
|
|
|
|
|
|
+ CXXConstructorDecl *BaseCtor = &*CtorIt;
|
|
bool CanBeCopyOrMove = BaseCtor->isCopyOrMoveConstructor();
|
|
bool CanBeCopyOrMove = BaseCtor->isCopyOrMoveConstructor();
|
|
const FunctionProtoType *BaseCtorType =
|
|
const FunctionProtoType *BaseCtorType =
|
|
BaseCtor->getType()->getAs<FunctionProtoType>();
|
|
BaseCtor->getType()->getAs<FunctionProtoType>();
|
|
@@ -7641,7 +7641,7 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpecAndConst(
|
|
FieldEnd = ClassDecl->field_end();
|
|
FieldEnd = ClassDecl->field_end();
|
|
HasConstCopyAssignment && Field != FieldEnd;
|
|
HasConstCopyAssignment && Field != FieldEnd;
|
|
++Field) {
|
|
++Field) {
|
|
- QualType FieldType = Context.getBaseElementType((*Field)->getType());
|
|
|
|
|
|
+ QualType FieldType = Context.getBaseElementType(Field->getType());
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
HasConstCopyAssignment &=
|
|
HasConstCopyAssignment &=
|
|
(bool)LookupCopyingAssignment(FieldClassDecl, Qualifiers::Const,
|
|
(bool)LookupCopyingAssignment(FieldClassDecl, Qualifiers::Const,
|
|
@@ -7693,7 +7693,7 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpecAndConst(
|
|
FieldEnd = ClassDecl->field_end();
|
|
FieldEnd = ClassDecl->field_end();
|
|
Field != FieldEnd;
|
|
Field != FieldEnd;
|
|
++Field) {
|
|
++Field) {
|
|
- QualType FieldType = Context.getBaseElementType((*Field)->getType());
|
|
|
|
|
|
+ QualType FieldType = Context.getBaseElementType(Field->getType());
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXMethodDecl *CopyAssign =
|
|
if (CXXMethodDecl *CopyAssign =
|
|
LookupCopyingAssignment(FieldClassDecl, ArgQuals, false, 0))
|
|
LookupCopyingAssignment(FieldClassDecl, ArgQuals, false, 0))
|
|
@@ -7919,7 +7919,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
|
|
CXXScopeSpec SS; // Intentionally empty
|
|
CXXScopeSpec SS; // Intentionally empty
|
|
LookupResult MemberLookup(*this, Field->getDeclName(), Loc,
|
|
LookupResult MemberLookup(*this, Field->getDeclName(), Loc,
|
|
LookupMemberName);
|
|
LookupMemberName);
|
|
- MemberLookup.addDecl(*Field);
|
|
|
|
|
|
+ MemberLookup.addDecl(&*Field);
|
|
MemberLookup.resolveKind();
|
|
MemberLookup.resolveKind();
|
|
ExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType,
|
|
ExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType,
|
|
Loc, /*IsArrow=*/false,
|
|
Loc, /*IsArrow=*/false,
|
|
@@ -8121,7 +8121,7 @@ Sema::ComputeDefaultedMoveAssignmentExceptionSpec(CXXRecordDecl *ClassDecl) {
|
|
FieldEnd = ClassDecl->field_end();
|
|
FieldEnd = ClassDecl->field_end();
|
|
Field != FieldEnd;
|
|
Field != FieldEnd;
|
|
++Field) {
|
|
++Field) {
|
|
- QualType FieldType = Context.getBaseElementType((*Field)->getType());
|
|
|
|
|
|
+ QualType FieldType = Context.getBaseElementType(Field->getType());
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXMethodDecl *MoveAssign = LookupMovingAssignment(FieldClassDecl,
|
|
if (CXXMethodDecl *MoveAssign = LookupMovingAssignment(FieldClassDecl,
|
|
false, 0))
|
|
false, 0))
|
|
@@ -8209,7 +8209,7 @@ static bool subobjectsHaveMoveOrTrivialCopy(Sema &S, CXXRecordDecl *ClassDecl,
|
|
for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
|
|
for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
|
|
FieldEnd = ClassDecl->field_end();
|
|
FieldEnd = ClassDecl->field_end();
|
|
Field != FieldEnd; ++Field) {
|
|
Field != FieldEnd; ++Field) {
|
|
- if (!hasMoveOrIsTriviallyCopyable(S, (*Field)->getType(), IsConstructor))
|
|
|
|
|
|
+ if (!hasMoveOrIsTriviallyCopyable(S, Field->getType(), IsConstructor))
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -8454,7 +8454,7 @@ void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
|
|
CXXScopeSpec SS; // Intentionally empty
|
|
CXXScopeSpec SS; // Intentionally empty
|
|
LookupResult MemberLookup(*this, Field->getDeclName(), Loc,
|
|
LookupResult MemberLookup(*this, Field->getDeclName(), Loc,
|
|
LookupMemberName);
|
|
LookupMemberName);
|
|
- MemberLookup.addDecl(*Field);
|
|
|
|
|
|
+ MemberLookup.addDecl(&*Field);
|
|
MemberLookup.resolveKind();
|
|
MemberLookup.resolveKind();
|
|
ExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType,
|
|
ExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType,
|
|
Loc, /*IsArrow=*/false,
|
|
Loc, /*IsArrow=*/false,
|
|
@@ -8670,7 +8670,7 @@ Sema::ComputeDefaultedCopyCtorExceptionSpecAndConst(CXXRecordDecl *ClassDecl) {
|
|
FieldEnd = ClassDecl->field_end();
|
|
FieldEnd = ClassDecl->field_end();
|
|
HasConstCopyConstructor && Field != FieldEnd;
|
|
HasConstCopyConstructor && Field != FieldEnd;
|
|
++Field) {
|
|
++Field) {
|
|
- QualType FieldType = Context.getBaseElementType((*Field)->getType());
|
|
|
|
|
|
+ QualType FieldType = Context.getBaseElementType(Field->getType());
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
HasConstCopyConstructor &=
|
|
HasConstCopyConstructor &=
|
|
(bool)LookupCopyingConstructor(FieldClassDecl, Qualifiers::Const);
|
|
(bool)LookupCopyingConstructor(FieldClassDecl, Qualifiers::Const);
|
|
@@ -8714,7 +8714,7 @@ Sema::ComputeDefaultedCopyCtorExceptionSpecAndConst(CXXRecordDecl *ClassDecl) {
|
|
FieldEnd = ClassDecl->field_end();
|
|
FieldEnd = ClassDecl->field_end();
|
|
Field != FieldEnd;
|
|
Field != FieldEnd;
|
|
++Field) {
|
|
++Field) {
|
|
- QualType FieldType = Context.getBaseElementType((*Field)->getType());
|
|
|
|
|
|
+ QualType FieldType = Context.getBaseElementType(Field->getType());
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
|
|
if (CXXConstructorDecl *CopyConstructor =
|
|
if (CXXConstructorDecl *CopyConstructor =
|
|
LookupCopyingConstructor(FieldClassDecl, Quals))
|
|
LookupCopyingConstructor(FieldClassDecl, Quals))
|
|
@@ -10939,7 +10939,7 @@ void Sema::MarkVirtualMembersReferenced(SourceLocation Loc,
|
|
const CXXRecordDecl *RD) {
|
|
const CXXRecordDecl *RD) {
|
|
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
|
|
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
|
|
e = RD->method_end(); i != e; ++i) {
|
|
e = RD->method_end(); i != e; ++i) {
|
|
- CXXMethodDecl *MD = *i;
|
|
|
|
|
|
+ CXXMethodDecl *MD = &*i;
|
|
|
|
|
|
// C++ [basic.def.odr]p2:
|
|
// C++ [basic.def.odr]p2:
|
|
// [...] A virtual member function is used if it is not pure. [...]
|
|
// [...] A virtual member function is used if it is not pure. [...]
|