diff options
Diffstat (limited to 'symtab.h')
-rw-r--r-- | symtab.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -25,6 +25,7 @@ using namespace std; extern vector<string*>* g_symbols; class Symtab; +class Var; class Symbol { public: @@ -54,6 +55,9 @@ class Symbol { bool IsValid() const { return v_ >= 0; } + Var* GetGlobalVar() const; + void SetGlobalVar(Var* v) const; + private: explicit Symbol(int v); @@ -62,6 +66,16 @@ class Symbol { friend class Symtab; }; +class ScopedGlobalVar { + public: + ScopedGlobalVar(Symbol name, Var* var); + ~ScopedGlobalVar(); + + private: + Symbol name_; + Var* orig_; +}; + inline bool operator==(const Symbol& x, const Symbol& y) { return x.val() == y.val(); } |