diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-23 22:00:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-23 22:00:08 +0000 |
commit | 1829a6db2ec19e08061f0bb2f4c52a8e5e4efaf0 (patch) | |
tree | 5e6ec0f846885aefd6f18f3dbdaa9bc6e38c8c47 /lib/Sema/SemaDeclObjC.cpp | |
parent | 60ff8ce5b2fda9c2a510f15d8b8504d0fc8c8e2f (diff) |
fix rdar://6611778, a redefinition of an interface was causing an
assertion when the ivars and method list was reset into the existing
interface. To fix this, mark decls as invalid when they are redefined,
and don't insert ivars/methods into invalid decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 660f745228..b3644a5ab9 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -78,6 +78,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, if (IDecl) { // Class already seen. Is it a forward declaration? if (!IDecl->isForwardDecl()) { + IDecl->setInvalidDecl(); Diag(AtInterfaceLoc, diag::err_duplicate_class_def)<<IDecl->getDeclName(); Diag(IDecl->getLocation(), diag::note_previous_definition); @@ -225,6 +226,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, if (PDecl) { // Protocol already seen. Better be a forward protocol declaration if (!PDecl->isForwardDecl()) { + PDecl->setInvalidDecl(); Diag(ProtocolLoc, diag::err_duplicate_protocol_def) << ProtocolName; Diag(PDecl->getLocation(), diag::note_previous_definition); // Just return the protocol we already had. @@ -555,8 +557,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName; Diag(PrevDecl->getLocation(), diag::note_previous_definition); - } - else { + } else { // Is there an interface declaration of this class; if not, warn! IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl); if (!IDecl) |