зеркало из https://github.com/microsoft/clang-1.git
Patch to re-implement duplicate ivar checking
(which will pass duplicate-ivar-check.m test again). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61161 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2342ef7579
Коммит
375d37c129
|
@ -3029,27 +3029,20 @@ void Sema::ActOnFields(Scope* S,
|
|||
ObjCIvarDecl **ClsFields = reinterpret_cast<ObjCIvarDecl**>(&RecFields[0]);
|
||||
if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(EnclosingDecl)) {
|
||||
ID->addInstanceVariablesToClass(ClsFields, RecFields.size(), RBrac);
|
||||
#if 0
|
||||
// Must enforce the rule that ivars in the base classes may not be
|
||||
// duplicates.
|
||||
FieldIDs.clear();
|
||||
RecordDecl *RD = ID->getRecordForDecl();
|
||||
for (RecordDecl::field_iterator i = RD->field_begin(),
|
||||
e = RD->field_end(); i != e; ++i) {
|
||||
FieldDecl *FD = *i;
|
||||
if (IdentifierInfo *II = FD->getIdentifier())
|
||||
if (!FieldIDs.insert(II)) {
|
||||
Diag(FD->getLocation(), diag::err_duplicate_member) << II;
|
||||
FD->setInvalidDecl();
|
||||
for (RecordDecl::field_iterator j = RD->field_begin(),
|
||||
e1 = RD->field_end(); j != e1; ++j)
|
||||
if (II == (*j)->getIdentifier()) {
|
||||
Diag((*j)->getLocation(), diag::note_previous_definition);
|
||||
break;
|
||||
}
|
||||
if (ID->getSuperClass()) {
|
||||
for (ObjCInterfaceDecl::ivar_iterator IVI = ID->ivar_begin(),
|
||||
IVE = ID->ivar_end(); IVI != IVE; ++IVI) {
|
||||
ObjCIvarDecl* Ivar = (*IVI);
|
||||
IdentifierInfo *II = Ivar->getIdentifier();
|
||||
ObjCIvarDecl* prevIvar = ID->getSuperClass()->FindIvarDeclaration(II);
|
||||
if (prevIvar) {
|
||||
Diag(Ivar->getLocation(), diag::err_duplicate_member) << II;
|
||||
Diag(prevIvar->getLocation(), diag::note_previous_definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (ObjCImplementationDecl *IMPDecl =
|
||||
dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче