Use a scoped object to manage entry/exit from a parser scope rather than explicitly calling EnterScope/ExitScope
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60830 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 4cf7c1e..9babd10 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1159,8 +1159,8 @@
// argument decls, decls within the compound expression, etc. This also
// allows determining whether a variable reference inside the block is
// within or outside of the block.
- EnterScope(Scope::BlockScope|Scope::FnScope|Scope::BreakScope|
- Scope::ContinueScope|Scope::DeclScope);
+ ParseScope BlockScope(this, Scope::BlockScope|Scope::FnScope|Scope::BreakScope|
+ Scope::ContinueScope|Scope::DeclScope);
// Inform sema that we are starting a block.
Actions.ActOnBlockStart(CaretLoc, CurScope);
@@ -1179,7 +1179,6 @@
// If there was an error parsing the arguments, they may have tried to use
// ^(x+y) which requires an argument list. Just skip the whole block
// literal.
- ExitScope();
return true;
}
} else {
@@ -1200,7 +1199,6 @@
Actions.ActOnBlockError(CaretLoc, CurScope);
}
}
- ExitScope();
return Result.result();
}