[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

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Oct 26 17:09:34 PDT 2011


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) {
   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
 





More information about the cfe-commits mailing list