00001
00002
00003 #ifndef variable_h
00004 #define variable_h
00005
00006 #include "symbol_table.h"
00007 #include "type_rep.h"
00008
00009
00010
00011
00012
00013
00014 class Class_symbol;
00022 class Variable_symbol : public Symbol {
00023 Type type;
00024 Storage_class_specifier storage_class;
00025 Ptree* initializer;
00026 Ptree* bitsize;
00027 bool has_addr;
00028 Class_symbol* in_class;
00029 public:
00030 Type get_type() const { return type; }
00031 Storage_class_specifier get_storage_class() const { return storage_class; }
00032 bool has_address() const { return has_addr; }
00033 Ptree* get_initializer() const { return initializer; }
00034 Ptree* get_bitsize() const { return bitsize; }
00035 bool is_member_variable() const { return storage_class == s_Member || storage_class == s_Mutable; }
00036
00037 public:
00039 Variable_symbol(Type type, Storage_class_specifier storage, Ptree* initializer, Ptree* bitsize, Symbol::Status status);
00040
00042 Variable_symbol(Type type, Storage_class_specifier storage, Ptree* initializer, Ptree* bitsize, bool has_address);
00043
00044 Symbol::Kind get_kind() const;
00045
00046 void set_class(Class_symbol* csym);
00047
00048 Class_symbol* get_class() const;
00049
00050 void define_variable(Storage_class_specifier storage, Ptree* initializer, Ptree* bitsize, Status status);
00051
00052 void dump(std::ostream& os);
00053 };
00054
00055
00056
00057
00058
00059
00060
00061 inline Class_symbol*
00062 Variable_symbol::get_class() const
00063 {
00064 return in_class;
00065 }
00066
00067 #endif // variable_h