diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-09-26 00:31:16 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-09-26 00:31:16 +0000 |
commit | aefc36656d3113ef32a50cea9ae0621e07c8b26c (patch) | |
tree | 0c32bd241707931a5eb0d23dd4787b34e0a148e4 | |
parent | 761d7f78e2dac7ea5f35828c2271e60d91e106ce (diff) |
Have @finally introduce a new scope.
Fixes: <rdar://problem/6248119> @finally doesn't introduce a new scope
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56629 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 3 | ||||
-rw-r--r-- | test/Sema/rdar6248119.m | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index e957db4ed9..8917eeb0ff 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1311,6 +1311,8 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) { } else { assert(Tok.isObjCAtKeyword(tok::objc_finally) && "Lookahead confused?"); ConsumeToken(); // consume finally + EnterScope(Scope::DeclScope); + StmtResult FinallyBody(true); if (Tok.is(tok::l_brace)) @@ -1322,6 +1324,7 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) { FinallyStmt = Actions.ActOnObjCAtFinallyStmt(AtCatchFinallyLoc, FinallyBody.Val); catch_or_finally_seen = true; + ExitScope(); break; } } diff --git a/test/Sema/rdar6248119.m b/test/Sema/rdar6248119.m new file mode 100644 index 0000000000..fbfa1e3af3 --- /dev/null +++ b/test/Sema/rdar6248119.m @@ -0,0 +1,11 @@ +// RUN: clang -fsyntax-only %s -verify +// Test case for: +// <rdar://problem/6248119> @finally doesn't introduce a new scope + +void f0() { + int i; + @try { + } @finally { + int i = 0; + } +} |