]> granicus.if.org Git - clang/commitdiff
Fix rdar://6814047, a crash on invalid in blocks code I noticed when
authorChris Lattner <sabre@nondot.org>
Tue, 21 Apr 2009 22:38:46 +0000 (22:38 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 21 Apr 2009 22:38:46 +0000 (22:38 +0000)
working on the previous fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69742 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/Sema/block-misc.c

index 57902cc02b532851ba9ba1338ea599eee2cc059f..fa857575c5d1ea16ae6433fd9c5a6dc5e345ecef 100644 (file)
@@ -4755,8 +4755,8 @@ void Sema::ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
   CurFunctionNeedsScopeChecking = CurBlock->SavedFunctionNeedsScopeChecking;
 
   // Pop off CurBlock, handle nested blocks.
+  PopDeclContext();
   CurBlock = CurBlock->PrevBlockInfo;
-
   // FIXME: Delete the ParmVarDecl objects as well???
 }
 
index 8775aa752ac28e0d764a4e2bdbc46e06f85852fc..bef2662bbcd8e20296ab820741c393f02ad2e784 100644 (file)
@@ -112,6 +112,13 @@ void test11(int i) {
     ^{ break; }();     // expected-error {{'break' statement not in loop or switch statement}}
 }
 
+
+void (^test12f)(void);
+void test12() {
+  test12f = ^test12f;  // expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}}
+}
+
+
 // rdar://6808730
 void *test13 = ^{
   int X = 32;
@@ -131,9 +138,3 @@ void test14() {
     };
   };
 }
-
-void (^test12f)(void);
-void test12() {
-  test12f = ^test12f;  // expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}}
-}
-