[cfe-commits] r70652 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaObjC/duplicate-ivar-check.m
Daniel Dunbar
daniel at zuster.org
Sat May 2 18:08:28 PDT 2009
Author: ddunbar
Date: Sat May 2 20:08:28 2009
New Revision: 70652
URL: http://llvm.org/viewvc/llvm-project?rev=70652&view=rev
Log:
Fix invalid error about duplicate declaration of padding bit field in
an interface.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaObjC/duplicate-ivar-check.m
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=70652&r1=70651&r2=70652&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat May 2 20:08:28 2009
@@ -3980,12 +3980,14 @@
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()->lookupInstanceVariable(Context, II);
- if (prevIvar) {
- Diag(Ivar->getLocation(), diag::err_duplicate_member) << II;
- Diag(prevIvar->getLocation(), diag::note_previous_declaration);
+
+ if (IdentifierInfo *II = Ivar->getIdentifier()) {
+ ObjCIvarDecl* prevIvar =
+ ID->getSuperClass()->lookupInstanceVariable(Context, II);
+ if (prevIvar) {
+ Diag(Ivar->getLocation(), diag::err_duplicate_member) << II;
+ Diag(prevIvar->getLocation(), diag::note_previous_declaration);
+ }
}
}
}
Modified: cfe/trunk/test/SemaObjC/duplicate-ivar-check.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/duplicate-ivar-check.m?rev=70652&r1=70651&r2=70652&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/duplicate-ivar-check.m (original)
+++ cfe/trunk/test/SemaObjC/duplicate-ivar-check.m Sat May 2 20:08:28 2009
@@ -3,6 +3,7 @@
@interface B1 {
@public
double fill_B; // expected-note {{previous declaration is here}}
+ unsigned : 0;
}
@end
@@ -10,6 +11,7 @@
@public
int one; // expected-note {{previous declaration is here}}
int one; // expected-error {{duplicate member 'one'}}
+ unsigned : 0;
}
@end
More information about the cfe-commits
mailing list