From: Ted Kremenek Date: Fri, 26 Sep 2008 17:32:47 +0000 (+0000) Subject: Enter a new scope for a @try block. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3527b59f246cde170e6877e3e62f78a95dbcdfce;p=clang Enter a new scope for a @try block. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56668 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 17488d523e..c48cc8aa1a 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1253,7 +1253,9 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) { } StmtResult CatchStmts; StmtResult FinallyStmt; + EnterScope(Scope::DeclScope); StmtResult TryBody = ParseCompoundStatementBody(); + ExitScope(); if (TryBody.isInvalid) TryBody = Actions.ActOnNullStmt(Tok.getLocation()); diff --git a/test/Sema/rdar6248119.m b/test/Sema/rdar6248119.m index fbfa1e3af3..ff402b296d 100644 --- a/test/Sema/rdar6248119.m +++ b/test/Sema/rdar6248119.m @@ -9,3 +9,19 @@ void f0() { int i = 0; } } + +void f1() { + int i; + @try { + int i =0; + } @finally { + } +} + +void f2() { + int i; + @try { + } @catch(id e) { + int i = 0; + } +}