Revert Decl's iterators back to pointer value_type rather than reference value_type
In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.
This rolls back r155808 and r155869.
Review by Doug Gregor incorporating feedback from Chandler Carruth.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158104 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 66a64a9..ae75b26 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -375,7 +375,7 @@
if (hadError)
return;
- FillInValueInitForField(Init, &*Field, Entity, ILE, RequiresSecondPass);
+ FillInValueInitForField(Init, *Field, Entity, ILE, RequiresSecondPass);
if (hadError)
return;
@@ -1336,9 +1336,9 @@
if (Field->getDeclName()) {
if (VerifyOnly)
CheckValueInitializable(
- InitializedEntity::InitializeMember(&*Field, &Entity));
+ InitializedEntity::InitializeMember(*Field, &Entity));
else
- StructuredList->setInitializedFieldInUnion(&*Field);
+ StructuredList->setInitializedFieldInUnion(*Field);
break;
}
}
@@ -1401,9 +1401,9 @@
// Make sure we can use this declaration.
bool InvalidUse;
if (VerifyOnly)
- InvalidUse = !SemaRef.CanUseDecl(&*Field);
+ InvalidUse = !SemaRef.CanUseDecl(*Field);
else
- InvalidUse = SemaRef.DiagnoseUseOfDecl(&*Field,
+ InvalidUse = SemaRef.DiagnoseUseOfDecl(*Field,
IList->getInit(Index)->getLocStart());
if (InvalidUse) {
++Index;
@@ -1413,14 +1413,14 @@
}
InitializedEntity MemberEntity =
- InitializedEntity::InitializeMember(&*Field, &Entity);
+ InitializedEntity::InitializeMember(*Field, &Entity);
CheckSubElementType(MemberEntity, IList, Field->getType(), Index,
StructuredList, StructuredIndex);
InitializedSomething = true;
if (DeclType->isUnionType() && !VerifyOnly) {
// Initialize the first field within the union.
- StructuredList->setInitializedFieldInUnion(&*Field);
+ StructuredList->setInitializedFieldInUnion(*Field);
}
++Field;
@@ -1449,7 +1449,7 @@
for (; Field != FieldEnd && !hadError; ++Field) {
if (!Field->isUnnamedBitfield())
CheckValueInitializable(
- InitializedEntity::InitializeMember(&*Field, &Entity));
+ InitializedEntity::InitializeMember(*Field, &Entity));
}
}
@@ -1457,7 +1457,7 @@
Index >= IList->getNumInits())
return;
- if (CheckFlexibleArrayInit(Entity, IList->getInit(Index), &*Field,
+ if (CheckFlexibleArrayInit(Entity, IList->getInit(Index), *Field,
TopLevelObject)) {
hadError = true;
++Index;
@@ -1465,7 +1465,7 @@
}
InitializedEntity MemberEntity =
- InitializedEntity::InitializeMember(&*Field, &Entity);
+ InitializedEntity::InitializeMember(*Field, &Entity);
if (isa<InitListExpr>(IList->getInit(Index)))
CheckSubElementType(MemberEntity, IList, Field->getType(), Index,
@@ -1679,7 +1679,7 @@
// IndirectFieldDecl that follow for the designated initializer.
if (!KnownField && Field->isAnonymousStructOrUnion()) {
if (IndirectFieldDecl *IF =
- FindIndirectFieldDesignator(&*Field, FieldName)) {
+ FindIndirectFieldDesignator(*Field, FieldName)) {
// In verify mode, don't modify the original.
if (VerifyOnly)
DIE = CloneDesignatedInitExpr(SemaRef, DIE);
@@ -1688,7 +1688,7 @@
break;
}
}
- if (KnownField && KnownField == &*Field)
+ if (KnownField && KnownField == *Field)
break;
if (FieldName && FieldName == Field->getIdentifier())
break;
@@ -1757,7 +1757,7 @@
if (Field->isUnnamedBitfield())
continue;
- if (ReplacementField == &*Field ||
+ if (ReplacementField == *Field ||
Field->getIdentifier() == ReplacementField->getIdentifier())
break;
@@ -1771,15 +1771,15 @@
if (RT->getDecl()->isUnion()) {
FieldIndex = 0;
if (!VerifyOnly)
- StructuredList->setInitializedFieldInUnion(&*Field);
+ StructuredList->setInitializedFieldInUnion(*Field);
}
// Make sure we can use this declaration.
bool InvalidUse;
if (VerifyOnly)
- InvalidUse = !SemaRef.CanUseDecl(&*Field);
+ InvalidUse = !SemaRef.CanUseDecl(*Field);
else
- InvalidUse = SemaRef.DiagnoseUseOfDecl(&*Field, D->getFieldLoc());
+ InvalidUse = SemaRef.DiagnoseUseOfDecl(*Field, D->getFieldLoc());
if (InvalidUse) {
++Index;
return true;
@@ -1787,7 +1787,7 @@
if (!VerifyOnly) {
// Update the designator with the field declaration.
- D->setField(&*Field);
+ D->setField(*Field);
// Make sure that our non-designated initializer list has space
// for a subobject corresponding to this field.
@@ -1809,7 +1809,7 @@
<< SourceRange(NextD->getStartLocation(),
DIE->getSourceRange().getEnd());
SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
- << &*Field;
+ << *Field;
}
Invalid = true;
}
@@ -1822,13 +1822,13 @@
diag::err_flexible_array_init_needs_braces)
<< DIE->getInit()->getSourceRange();
SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
- << &*Field;
+ << *Field;
}
Invalid = true;
}
// Check GNU flexible array initializer.
- if (!Invalid && CheckFlexibleArrayInit(Entity, DIE->getInit(), &*Field,
+ if (!Invalid && CheckFlexibleArrayInit(Entity, DIE->getInit(), *Field,
TopLevelObject))
Invalid = true;
@@ -1844,7 +1844,7 @@
IList->setInit(Index, DIE->getInit());
InitializedEntity MemberEntity =
- InitializedEntity::InitializeMember(&*Field, &Entity);
+ InitializedEntity::InitializeMember(*Field, &Entity);
CheckSubElementType(MemberEntity, IList, Field->getType(), Index,
StructuredList, newStructuredIndex);
@@ -1863,7 +1863,7 @@
unsigned newStructuredIndex = FieldIndex;
InitializedEntity MemberEntity =
- InitializedEntity::InitializeMember(&*Field, &Entity);
+ InitializedEntity::InitializeMember(*Field, &Entity);
if (CheckDesignatedInitializer(MemberEntity, IList, DIE, DesigIdx + 1,
FieldType, 0, 0, Index,
StructuredList, newStructuredIndex,