diff options
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang/Parse/Action.h | 14 | ||||
| -rw-r--r-- | clang/include/clang/Parse/Parser.h | 8 |
2 files changed, 18 insertions, 4 deletions
diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h index 678e62e10b3..a07c99d9f08 100644 --- a/clang/include/clang/Parse/Action.h +++ b/clang/include/clang/Parse/Action.h @@ -64,7 +64,21 @@ namespace clang { /// parse to complete accurately. The MinimalAction class does this /// bare-minimum of tracking to implement this functionality. class Action : public ActionBase { + /// \brief The parser's current scope. + /// + /// The parser maintains this state here so that is accessible to \c Action + /// subclasses via \c getCurScope(). + Scope *CurScope; + +protected: + friend class Parser; + + /// \brief Retrieve the parser's current scope. + Scope *getCurScope() const { return CurScope; } + public: + Action() : CurScope(0) { } + /// Out-of-line virtual destructor to provide home for this class. virtual ~Action(); diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 0ba348159ff..91050fd7907 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -94,7 +94,6 @@ class Parser { /// and SemaActions for those uses that don't matter. Action &Actions; - Scope *CurScope; Diagnostic &Diags; /// ScopeCache - Cache scopes to reduce malloc traffic. @@ -141,7 +140,8 @@ public: Action &getActions() const { return Actions; } const Token &getCurToken() const { return Tok; } - + Scope *getCurScope() const { return Actions.getCurScope(); } + // Type forwarding. All of these are statically 'void*', but they may all be // different actual classes based on the actions in place. typedef Action::ExprTy ExprTy; @@ -1347,14 +1347,14 @@ private: CreatedScope = true; P.EnterScope(0); // Not a decl scope. - if (!P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS)) + if (!P.Actions.ActOnCXXEnterDeclaratorScope(P.getCurScope(), SS)) EnteredScope = true; } ~DeclaratorScopeObj() { if (EnteredScope) { assert(SS.isSet() && "C++ scope was cleared ?"); - P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS); + P.Actions.ActOnCXXExitDeclaratorScope(P.getCurScope(), SS); } if (CreatedScope) P.ExitScope(); |

