Break the assumption that any sort of scope (e.g. a loop scope) can
hold declarations. Instead, introduce a new "DeclScope" scope type that
holds them explicitly. For now, all scopes have this bit, but in the
future we can use them to fix some issues Neil noticed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41431 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp
index d9d7961..d034dc2 100644
--- a/Parse/Parser.cpp
+++ b/Parse/Parser.cpp
@@ -221,11 +221,10 @@
// Prime the lexer look-ahead.
ConsumeToken();
- // Create the global scope, install it as the current scope.
+ // Create the translation unit scope. Install it as the current scope.
assert(CurScope == 0 && "A scope is already active?");
- EnterScope(0);
-
-
+ EnterScope(Scope::DeclScope);
+
// Install builtin types.
// TODO: Move this someplace more useful.
{
@@ -435,7 +434,7 @@
ParseKNRParamDeclarations(D);
// Enter a scope for the function body.
- EnterScope(Scope::FnScope);
+ EnterScope(Scope::FnScope|Scope::DeclScope);
// Tell the actions module that we have entered a function definition with the
// specified Declarator for the function.