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 17488d5..c48cc8a 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1253,7 +1253,9 @@
}
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 fbfa1e3..ff402b2 100644
--- a/test/Sema/rdar6248119.m
+++ b/test/Sema/rdar6248119.m
@@ -9,3 +9,19 @@
int i = 0;
}
}
+
+void f1() {
+ int i;
+ @try {
+ int i =0;
+ } @finally {
+ }
+}
+
+void f2() {
+ int i;
+ @try {
+ } @catch(id e) {
+ int i = 0;
+ }
+}