]> granicus.if.org Git - clang/commitdiff
Fix crash on an @interface nested inside @implementation, rdar://10336158
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 27 Oct 2011 00:09:34 +0000 (00:09 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 27 Oct 2011 00:09:34 +0000 (00:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143085 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Parser.h
include/clang/Sema/Sema.h
lib/Sema/SemaDecl.cpp
test/SemaObjC/incomplete-implementation.m

index c863e76b9d474a52a85bbe02d2380180c566170e..673b5df0933551fc36ad93b31cf107e3030ff90c 100644 (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));
     }
   };
 
index acfdf7a5833cadcce47ebf645d8afbc3009e9a37..a0f4a628fa180d9ca2bc6562f81928f808fee6b4 100644 (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.
index 7ad8fb34b8bd8383c8b358f5d587bcae6272512d..4fa9cbdcc5dab9eef8d754a3c5baecf4a8db6361 100644 (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;
 }
 
index f5c5a7cc1813b264e93d7433cc63006d6512d08a..a79628aeedd349dde6c2344083811463757a236c 100644 (file)
 - 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