Suggestion for Scope class


The Parser is passing the current scope to many of Sema's methods, while, at the same time, Sema is managing the current decl context state through the CurFunctionDecl, CurMethodDecl, and CurContext variables.
I suggest adding a decl context member to the Scope class like this:

+ /// ParentDecl - The declaration that this scope is created for.
+ /// It is up to the current Action implementation to implement the semantics.
+ Action::DeclTy *ParentDecl;

+ /// getParentDecl - Return the decl that this scope is created for.
+ /// It is for use by the Action implementation.
+ ///
+ Action::DeclTy *getParentDecl() const { return ParentDecl; }