aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-10 06:34:36 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-10 06:34:36 +0000
commit8935b8b49053122ddd3ab4cd59af0fe5eb9c23cf (patch)
tree318bf0963024974c0d88316c5fa97ee64def97b8 /lib/Parse/Parser.cpp
parent565c99f45e758406f26404e92fadd15d8b84a8c4 (diff)
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
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index d040efd7ac..3d72b60b86 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -287,7 +287,7 @@ bool Parser::ParseTopLevelDecl(DeclTy*& Result) {
/// external-declaration
/// translation-unit external-declaration
void Parser::ParseTranslationUnit() {
- Initialize(); // pushes a scope.
+ Initialize();
DeclTy *Res;
while (!ParseTopLevelDecl(Res))
@@ -526,7 +526,7 @@ Parser::DeclTy *Parser::ParseFunctionDefinition(Declarator &D) {
}
// Enter a scope for the function body.
- EnterScope(Scope::FnScope|Scope::DeclScope);
+ ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope);
// Tell the actions module that we have entered a function definition with the
// specified Declarator for the function.
@@ -549,7 +549,7 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
// Enter function-declaration scope, limiting any declarators to the
// function prototype scope, including parameter declarators.
- EnterScope(Scope::FnScope|Scope::DeclScope);
+ ParseScope PrototypeScope(this, Scope::FnScope|Scope::DeclScope);
// Read all the argument declarations.
while (isDeclarationSpecifier()) {
@@ -653,9 +653,6 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
}
}
- // Leave prototype scope.
- ExitScope();
-
// The actions module must verify that all arguments were declared.
}