[cfe-commits] r143085 - in /cfe/trunk: include/clang/Parse/Parser.h include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp test/SemaObjC/incomplete-implementation.m

Fariborz Jahanian fjahanian at apple.com
Wed Oct 26 17:31:32 PDT 2011


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
> 
> + at interface Q
> + at end
> +
> +// rdar://10336158
> + at implementation Q
> +
> +__attribute__((visibility("default")))
> + at interface QN 
> +{
> +}
> + at end
> +
> + at end
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list