Fix crash on an @interface nested inside @implementation, rdar://10336158

llvm-svn: 143085
This commit is contained in:
Argyrios Kyrtzidis 2011-10-27 00:09:34 +00:00
parent f26b12ada0
commit a9aabf7d51
4 changed files with 20 additions and 7 deletions

View File

@ -607,11 +607,11 @@ private:
explicit ObjCDeclContextSwitch(Parser &p) : P(p),
DC(p.getObjCDeclContext()) {
if (DC)
P.Actions.ActOnObjCTemporaryExitContainerContext();
P.Actions.ActOnObjCTemporaryExitContainerContext(cast<DeclContext>(DC));
}
~ObjCDeclContextSwitch() {
if (DC)
P.Actions.ActOnObjCReenterContainerContext();
P.Actions.ActOnObjCReenterContainerContext(cast<DeclContext>(DC));
}
};

View File

@ -1245,8 +1245,8 @@ public:
/// scope for parsing/looking-up C constructs.
///
/// Must be followed by a call to \see ActOnObjCReenterContainerContext
void ActOnObjCTemporaryExitContainerContext();
void ActOnObjCReenterContainerContext();
void ActOnObjCTemporaryExitContainerContext(DeclContext *DC);
void ActOnObjCReenterContainerContext(DeclContext *DC);
/// ActOnTagDefinitionError - Invoked when there was an unrecoverable
/// error parsing the definition of a tag.

View File

@ -8287,13 +8287,13 @@ void Sema::ActOnObjCContainerFinishDefinition() {
PopDeclContext();
}
void Sema::ActOnObjCTemporaryExitContainerContext() {
void Sema::ActOnObjCTemporaryExitContainerContext(DeclContext *DC) {
OriginalLexicalContext = CurContext;
ActOnObjCContainerFinishDefinition();
}
void Sema::ActOnObjCReenterContainerContext() {
ActOnObjCContainerStartDefinition(cast<Decl>(OriginalLexicalContext));
void Sema::ActOnObjCReenterContainerContext(DeclContext *DC) {
ActOnObjCContainerStartDefinition(cast<Decl>(DC));
OriginalLexicalContext = 0;
}

View File

@ -24,4 +24,17 @@
- Meth {return 0;} // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
@end
@interface Q
@end
// rdar://10336158
@implementation Q
__attribute__((visibility("default")))
@interface QN
{
}
@end
@end