Diagnose that ivars in current and super class may not
be duplicates and a test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61068 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 7e2a99f..9e803b7 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -345,7 +345,8 @@
for (ObjCInterfaceDecl::ivar_iterator I = ivar_begin(),
E = ivar_end(); I != E; ++I) {
ObjCIvarDecl *IVDecl = (*I);
- Fields.push_back(cast<FieldDecl>(IVDecl));
+ if (!IVDecl->isInvalidDecl())
+ Fields.push_back(cast<FieldDecl>(IVDecl));
}
}
@@ -390,7 +391,8 @@
/// FIXME! Can do collection of ivars and adding to the record while
/// doing it.
for (unsigned int i = 0; i != RecFields.size(); i++) {
- FieldDecl *Field = FieldDecl::Create(Context, RD, SourceLocation(),
+ FieldDecl *Field = FieldDecl::Create(Context, RD,
+ RecFields[i]->getLocation(),
RecFields[i]->getIdentifier(),
RecFields[i]->getType(),
RecFields[i]->getBitWidth(), false, 0);