On Oct 26, 2011, at 5:09 PM, Argyrios Kyrtzidis wrote:

> Author: akirtzidis
> Date: Wed Oct 26 19:09:34 2011
> New Revision: 143085
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=143085&view=rev
> Log:
> Fix crash on an @interface nested inside @implementation, rdar://10336158
> 
> Modified:
>    cfe/trunk/include/clang/Parse/Parser.h
>    cfe/trunk/include/clang/Sema/Sema.h
>    cfe/trunk/lib/Sema/SemaDecl.cpp
>    cfe/trunk/test/SemaObjC/incomplete-implementation.m
> 
> Modified: cfe/trunk/include/clang/Parse/Parser.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=143085&r1=143084&r2=143085&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Parse/Parser.h (original)
> +++ cfe/trunk/include/clang/Parse/Parser.h Wed Oct 26 19:09:34 2011
> @@ -607,11 +607,11 @@
>     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));
>     }
>   };
> 
> 
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=143085&r1=143084&r2=143085&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Sema/Sema.h (original)
> +++ cfe/trunk/include/clang/Sema/Sema.h Wed Oct 26 19:09:34 2011
> @@ -1245,8 +1245,8 @@
>   /// 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.
> 
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=143085&r1=143084&r2=143085&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Oct 26 19:09:34 2011
> @@ -8287,13 +8287,13 @@
>   PopDeclContext();
> }
> 
> -void Sema::ActOnObjCTemporaryExitContainerContext() {
> +void Sema::ActOnObjCTemporaryExitContainerContext(DeclContext *DC) {

"DC" is unused here.

- Fariborz

>   OriginalLexicalContext = CurContext;
>   ActOnObjCContainerFinishDefinition();
> }
> 
> -void Sema::ActOnObjCReenterContainerContext() {
> -  ActOnObjCContainerStartDefinition(cast<Decl>(OriginalLexicalContext));
> +void Sema::ActOnObjCReenterContainerContext(DeclContext *DC) {
> +  ActOnObjCContainerStartDefinition(cast<Decl>(DC));
>   OriginalLexicalContext = 0;
> }
> 
> 
> Modified: cfe/trunk/test/SemaObjC/incomplete-implementation.m
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/incomplete-implementation.m?rev=143085&r1=143084&r2=143085&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/incomplete-implementation.m (original)
> +++ cfe/trunk/test/SemaObjC/incomplete-implementation.m Wed Oct 26 19:09:34 
> 2011
> @@ -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
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to