aboutsummaryrefslogtreecommitdiff
path: root/symtab.h
diff options
context:
space:
mode:
Diffstat (limited to 'symtab.h')
-rw-r--r--symtab.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/symtab.h b/symtab.h
index 9d8a120..d1de4e1 100644
--- a/symtab.h
+++ b/symtab.h
@@ -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();
}