Parser::ParseObjCSynchronizedStmt() needs to Enter/Exit a decl scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51963 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 933a7a6..1745074 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1143,7 +1143,13 @@
Diag (Tok, diag::err_expected_lbrace);
return true;
}
+ // Enter a scope to hold everything within the compound stmt. Compound
+ // statements can always hold declarations.
+ EnterScope(Scope::DeclScope);
+
StmtResult SynchBody = ParseCompoundStatementBody();
+
+ ExitScope();
if (SynchBody.isInvalid)
SynchBody = Actions.ActOnNullStmt(Tok.getLocation());
return Actions.ActOnObjCAtSynchronizedStmt(atLoc, Res.Val, SynchBody.Val);