diff --git a/vhdlpp/expression.cc b/vhdlpp/expression.cc index 8c2061968..7029092ac 100644 --- a/vhdlpp/expression.cc +++ b/vhdlpp/expression.cc @@ -659,7 +659,7 @@ void ExpName::visit(ExprVisitor& func) func(this); } -int ExpName::index_t::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpName::index_t::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; diff --git a/vhdlpp/expression.h b/vhdlpp/expression.h index bed415af5..1df357f4d 100644 --- a/vhdlpp/expression.h +++ b/vhdlpp/expression.h @@ -97,11 +97,11 @@ class Expression : public LineInfo { // The emit virtual method is called by architecture emit to // output the generated code for the expression. The derived // class fills in the details of what exactly happened. - virtual int emit(ostream&out, Entity*ent, ScopeBase*scope) =0; + virtual int emit(ostream&out, Entity*ent, ScopeBase*scope) const =0; // The emit_package virtual message is similar, but is called // in a package context and to emit SV packages. - virtual int emit_package(std::ostream&out); + virtual int emit_package(std::ostream&out) const; // The evaluate virtual method tries to evaluate expressions // to constant literal values. Return true and set the val @@ -176,7 +176,7 @@ class ExpUnary : public Expression { inline void write_to_stream_operand1(std::ostream&fd) const { operand1_->write_to_stream(fd); } - int emit_operand1(ostream&out, Entity*ent, ScopeBase*scope); + int emit_operand1(ostream&out, Entity*ent, ScopeBase*scope) const; void dump_operand1(ostream&out, int indent = 0) const; private: @@ -202,8 +202,8 @@ class ExpBinary : public Expression { protected: int elaborate_exprs(Entity*, ScopeBase*, const VType*); - int emit_operand1(ostream&out, Entity*ent, ScopeBase*scope); - int emit_operand2(ostream&out, Entity*ent, ScopeBase*scope); + int emit_operand1(ostream&out, Entity*ent, ScopeBase*scope) const; + int emit_operand2(ostream&out, Entity*ent, ScopeBase*scope) const; bool eval_operand1(Entity*ent, ScopeBase*scope, int64_t&val) const; bool eval_operand2(Entity*ent, ScopeBase*scope, int64_t&val) const; @@ -308,15 +308,15 @@ class ExpAggregate : public Expression { const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; void visit(ExprVisitor& func); private: int elaborate_expr_array_(Entity*ent, ScopeBase*scope, const VTypeArray*ltype); int elaborate_expr_record_(Entity*ent, ScopeBase*scope, const VTypeRecord*ltype); - int emit_array_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeArray*ltype); - int emit_record_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeRecord*ltype); + int emit_array_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeArray*ltype) const; + int emit_record_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeRecord*ltype) const; private: // This is the elements as directly parsed. @@ -342,7 +342,7 @@ class ExpArithmetic : public ExpBinary { int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; virtual bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const; void dump(ostream&out, int indent = 0) const; @@ -386,7 +386,7 @@ class ExpObjAttribute : public ExpAttribute { inline const ExpName* peek_base() const { return base_; } - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; const VType*probe_type(Entity*ent, ScopeBase*scope) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; @@ -408,7 +408,7 @@ class ExpTypeAttribute : public ExpAttribute { inline const VType* peek_base() const { return base_; } - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; const VType*probe_type(Entity*ent, ScopeBase*scope) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; @@ -434,7 +434,7 @@ class ExpBitstring : public Expression { const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; private: @@ -454,7 +454,7 @@ class ExpCharacter : public Expression { const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; bool is_primary(void) const; void dump(ostream&out, int indent = 0) const; @@ -462,7 +462,7 @@ class ExpCharacter : public Expression { private: int emit_primitive_bit_(ostream&out, Entity*ent, ScopeBase*scope, - const VTypePrimitive*etype); + const VTypePrimitive*etype) const; private: char value_; @@ -482,7 +482,7 @@ class ExpConcat : public Expression { const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; bool is_primary(void) const; void dump(ostream&out, int indent = 0) const; void visit(ExprVisitor& func); @@ -513,8 +513,8 @@ class ExpConditional : public Expression { inline void set_condition(Expression*cond) { cond_ = cond; } int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*lt); - int emit_option(ostream&out, Entity*ent, ScopeBase*scope); - int emit_default(ostream&out, Entity*ent, ScopeBase*scope); + int emit_option(ostream&out, Entity*ent, ScopeBase*scope) const; + int emit_default(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; std::list& extract_true_clause() { return true_clause_; } void visit(ExprVisitor& func); @@ -534,7 +534,7 @@ class ExpConditional : public Expression { const VType*probe_type(Entity*ent, ScopeBase*scope) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; void visit(ExprVisitor& func); @@ -574,7 +574,7 @@ class ExpEdge : public ExpUnary { inline fun_t edge_fun() const { return fun_; } void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; private: @@ -600,7 +600,7 @@ class ExpFunc : public Expression { const VType*probe_type(Entity*ent, ScopeBase*scope) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; void visit(ExprVisitor& func); // NOTE: does not handle expressions in subprogram @@ -622,8 +622,8 @@ class ExpInteger : public Expression { const VType*probe_type(Entity*ent, ScopeBase*scope) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); - int emit_package(std::ostream&out); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; + int emit_package(std::ostream&out) const; bool is_primary(void) const { return true; } bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const; void dump(ostream&out, int indent = 0) const; @@ -645,8 +645,8 @@ class ExpReal : public Expression { const VType*probe_type(Entity*ent, ScopeBase*scope) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); - int emit_package(std::ostream&out); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; + int emit_package(std::ostream&out) const; bool is_primary(void) const; void dump(ostream&out, int indent = 0) const; virtual ostream& dump_inline(ostream&out) const; @@ -672,7 +672,7 @@ class ExpLogical : public ExpBinary { int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; private: @@ -705,7 +705,7 @@ class ExpName : public Expression { const VType* fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*host) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; bool is_primary(void) const; bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const; bool symbolic_compare(const Expression*that) const; @@ -726,7 +726,7 @@ class ExpName : public Expression { delete offset_; } - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; private: Expression*idx_; @@ -740,14 +740,14 @@ class ExpName : public Expression { const VType* probe_prefix_type_(Entity*ent, ScopeBase*scope) const; const VType* probe_prefixed_type_(Entity*ent, ScopeBase*scope) const; - int emit_as_prefix_(ostream&out, Entity*ent, ScopeBase*scope); + int emit_as_prefix_(ostream&out, Entity*ent, ScopeBase*scope) const; // There are some workarounds required for constant arrays/records, as // they are currently emitted as flat localparams (without any type // information). The following workarounds adjust the access indices // to select appropriate parts of the localparam. bool try_workarounds_(ostream&out, Entity*ent, ScopeBase*scope, - list&indices, int&data_size); + list&indices, int&data_size) const; bool check_const_array_workaround_(const VTypeArray*arr, ScopeBase*scope, list&indices, int&data_size) const; @@ -756,7 +756,7 @@ class ExpName : public Expression { list&indices, int&data_size) const; int emit_workaround_(ostream&out, Entity*ent, ScopeBase*scope, - const list&indices, int field_size); + const list&indices, int field_size) const; private: std::auto_ptr prefix_; @@ -793,7 +793,7 @@ class ExpRelation : public ExpBinary { const VType* probe_type(Entity*ent, ScopeBase*scope) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; private: @@ -813,7 +813,7 @@ class ExpShift : public ExpBinary { int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const; void dump(ostream&out, int indent = 0) const; @@ -833,7 +833,7 @@ class ExpString : public Expression { const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const; int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; bool is_primary(void) const; void dump(ostream&out, int indent = 0) const; const std::string& get_value() const { return value_; } @@ -843,7 +843,7 @@ class ExpString : public Expression { static std::string escape_quot(const std::string& str); private: - int emit_as_array_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeArray*arr); + int emit_as_array_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeArray*arr) const; private: std::string value_; @@ -858,7 +858,7 @@ class ExpUAbs : public ExpUnary { Expression*clone() const { return new ExpUAbs(peek_operand()->clone()); } void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; }; @@ -871,7 +871,7 @@ class ExpUNot : public ExpUnary { Expression*clone() const { return new ExpUNot(peek_operand()->clone()); } void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; }; @@ -890,7 +890,7 @@ class ExpCast : public Expression { return base_->elaborate_expr(ent, scope, type_); } void write_to_stream(std::ostream&fd) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; void visit(ExprVisitor& func); @@ -913,7 +913,7 @@ class ExpNew : public Expression { // There is no 'new' in VHDL - do not emit anything void write_to_stream(std::ostream&) const {}; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; void visit(ExprVisitor& func); @@ -931,7 +931,7 @@ class ExpTime : public Expression { int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; //bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const; void dump(ostream&out, int indent = 0) const; @@ -966,7 +966,7 @@ class ExpRange : public Expression { int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&) const; - int emit(ostream&out, Entity*ent, ScopeBase*scope); + int emit(ostream&out, Entity*ent, ScopeBase*scope) const; void dump(ostream&out, int indent = 0) const; private: // Regular range related fields diff --git a/vhdlpp/expression_emit.cc b/vhdlpp/expression_emit.cc index 8a22c5500..a940a32cc 100644 --- a/vhdlpp/expression_emit.cc +++ b/vhdlpp/expression_emit.cc @@ -62,7 +62,7 @@ inline static int emit_logic(char val, ostream& out, const VTypePrimitive::type_ return 0; } -int Expression::emit(ostream&out, Entity*, ScopeBase*) +int Expression::emit(ostream&out, Entity*, ScopeBase*) const { out << " /* " << get_fileline() << ": internal error: " << "I don't know how to emit this expression! " @@ -70,7 +70,7 @@ int Expression::emit(ostream&out, Entity*, ScopeBase*) return 1; } -int Expression::emit_package(ostream&out) +int Expression::emit_package(ostream&out) const { out << " /* " << get_fileline() << ": internal error: " << "I don't know how to emit_package this expression! " @@ -83,7 +83,7 @@ bool Expression::is_primary(void) const return false; } -int ExpBinary::emit_operand1(ostream&out, Entity*ent, ScopeBase*scope) +int ExpBinary::emit_operand1(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; bool oper_primary = operand1_->is_primary(); @@ -93,7 +93,7 @@ int ExpBinary::emit_operand1(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpBinary::emit_operand2(ostream&out, Entity*ent, ScopeBase*scope) +int ExpBinary::emit_operand2(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; bool oper_primary = operand2_->is_primary(); @@ -103,14 +103,14 @@ int ExpBinary::emit_operand2(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpUnary::emit_operand1(ostream&out, Entity*ent, ScopeBase*scope) +int ExpUnary::emit_operand1(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; errors += operand1_->emit(out, ent, scope); return errors; } -int ExpAggregate::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpAggregate::emit(ostream&out, Entity*ent, ScopeBase*scope) const { if (peek_type() == 0) { out << "/* " << get_fileline() << ": internal error: " @@ -134,7 +134,7 @@ int ExpAggregate::emit(ostream&out, Entity*ent, ScopeBase*scope) return 1; } -int ExpAggregate::emit_array_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeArray*atype) +int ExpAggregate::emit_array_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeArray*atype) const { int errors = 0; @@ -194,8 +194,8 @@ int ExpAggregate::emit_array_(ostream&out, Entity*ent, ScopeBase*scope, const VT if(use_msb < use_lsb) swap(use_msb, use_lsb); - map element_map; - choice_element*element_other = 0; + map element_map; + const choice_element*element_other = 0; bool positional_section = true; int64_t positional_idx = use_msb; @@ -283,7 +283,7 @@ int ExpAggregate::emit_array_(ostream&out, Entity*ent, ScopeBase*scope, const VT out << "{"; for (int64_t idx = use_msb ; idx >= use_lsb ; idx -= 1) { - choice_element*cur = element_map[idx]; + const choice_element*cur = element_map[idx]; if (cur == 0) cur = element_other; @@ -303,7 +303,7 @@ int ExpAggregate::emit_array_(ostream&out, Entity*ent, ScopeBase*scope, const VT return errors; } -int ExpAggregate::emit_record_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeRecord*) +int ExpAggregate::emit_record_(ostream&out, Entity*ent, ScopeBase*scope, const VTypeRecord*) const { int errors = 0; @@ -331,7 +331,7 @@ int ExpAggregate::emit_record_(ostream&out, Entity*ent, ScopeBase*scope, const V return errors; } -int ExpObjAttribute::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpObjAttribute::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; @@ -372,7 +372,7 @@ int ExpObjAttribute::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpTypeAttribute::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpTypeAttribute::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; @@ -409,7 +409,7 @@ int ExpTypeAttribute::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpArithmetic::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpArithmetic::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; @@ -463,7 +463,7 @@ int ExpArithmetic::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpBitstring::emit(ostream&out, Entity*, ScopeBase*) +int ExpBitstring::emit(ostream&out, Entity*, ScopeBase*) const { int errors = 0; @@ -475,7 +475,7 @@ int ExpBitstring::emit(ostream&out, Entity*, ScopeBase*) } int ExpCharacter::emit_primitive_bit_(ostream&out, Entity*, ScopeBase*, - const VTypePrimitive*etype) + const VTypePrimitive*etype) const { out << "1'b"; int res = emit_logic(value_, out, etype->type()); @@ -488,7 +488,7 @@ int ExpCharacter::emit_primitive_bit_(ostream&out, Entity*, ScopeBase*, return res; } -int ExpCharacter::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpCharacter::emit(ostream&out, Entity*ent, ScopeBase*scope) const { const VType*etype = peek_type(); const VTypeArray*array; @@ -519,7 +519,7 @@ bool ExpConcat::is_primary(void) const return true; } -int ExpConcat::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpConcat::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; out << "{"; @@ -530,7 +530,7 @@ int ExpConcat::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpConditional::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpConditional::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; out << "("; @@ -538,10 +538,10 @@ int ExpConditional::emit(ostream&out, Entity*ent, ScopeBase*scope) // Draw out any when-else expressions. These are all the else_ // clauses besides the last. if (options_.size() > 1) { - list::iterator last = options_.end(); + list::const_iterator last = options_.end(); --last; - for (list::iterator cur = options_.begin() + for (list::const_iterator cur = options_.begin() ; cur != last ; ++cur) { errors += (*cur)->emit_option(out, ent, scope); } @@ -560,7 +560,7 @@ int ExpConditional::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpConditional::case_t::emit_option(ostream&out, Entity*ent, ScopeBase*scope) +int ExpConditional::case_t::emit_option(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; assert(cond_ != 0); @@ -582,7 +582,7 @@ int ExpConditional::case_t::emit_option(ostream&out, Entity*ent, ScopeBase*scope return errors; } -int ExpConditional::case_t::emit_default(ostream&out, Entity*ent, ScopeBase*scope) +int ExpConditional::case_t::emit_default(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; // Trailing else must have no condition. @@ -599,7 +599,7 @@ int ExpConditional::case_t::emit_default(ostream&out, Entity*ent, ScopeBase*scop return errors; } -int ExpEdge::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpEdge::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; switch (fun_) { @@ -616,7 +616,7 @@ int ExpEdge::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpFunc::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpFunc::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; @@ -642,25 +642,25 @@ int ExpFunc::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpInteger::emit(ostream&out, Entity*, ScopeBase*) +int ExpInteger::emit(ostream&out, Entity*, ScopeBase*) const { out << "32'd" << value_; return 0; } -int ExpInteger::emit_package(ostream&out) +int ExpInteger::emit_package(ostream&out) const { out << value_; return 0; } -int ExpReal::emit(ostream&out, Entity*, ScopeBase*) +int ExpReal::emit(ostream&out, Entity*, ScopeBase*) const { out << value_; return 0; } -int ExpReal::emit_package(ostream&out) +int ExpReal::emit_package(ostream&out) const { out << value_; return 0; @@ -671,7 +671,7 @@ bool ExpReal::is_primary(void) const return true; } -int ExpLogical::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpLogical::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; @@ -703,7 +703,7 @@ int ExpLogical::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpName::emit_as_prefix_(ostream&out, Entity*ent, ScopeBase*scope) +int ExpName::emit_as_prefix_(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; if (prefix_.get()) { @@ -721,7 +721,7 @@ int ExpName::emit_as_prefix_(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpName::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpName::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; int field_size = 0; @@ -763,7 +763,7 @@ int ExpName::emit(ostream&out, Entity*ent, ScopeBase*scope) } bool ExpName::try_workarounds_(ostream&out, Entity*ent, ScopeBase*scope, - list& indices, int& data_size) + list& indices, int& data_size) const { Expression*exp = NULL; bool wrkand_required = false; @@ -860,7 +860,7 @@ bool ExpName::check_const_record_workaround_(const VTypeRecord*rec, } int ExpName::emit_workaround_(ostream&out, Entity*ent, ScopeBase*scope, - const list& indices, int field_size) + const list& indices, int field_size) const { int errors = 0; @@ -882,7 +882,7 @@ bool ExpName::is_primary(void) const return true; } -int ExpRelation::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpRelation::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; errors += emit_operand1(out, ent, scope); @@ -912,7 +912,7 @@ int ExpRelation::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpShift::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpShift::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; @@ -947,7 +947,7 @@ bool ExpString::is_primary(void) const return true; } -int ExpString::emit(ostream& out, Entity*ent, ScopeBase*scope) +int ExpString::emit(ostream& out, Entity*ent, ScopeBase*scope) const { const VTypeArray*arr; const VType*type = peek_type(); @@ -962,7 +962,7 @@ int ExpString::emit(ostream& out, Entity*ent, ScopeBase*scope) return 0; } -int ExpString::emit_as_array_(ostream& out, Entity*, ScopeBase*, const VTypeArray*arr) +int ExpString::emit_as_array_(ostream& out, Entity*, ScopeBase*, const VTypeArray*arr) const { int errors = 0; assert(arr->dimensions() == 1); @@ -1010,7 +1010,7 @@ std::string ExpString::escape_quot(const std::string& str) return result; } -int ExpUAbs::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpUAbs::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; out << "abs("; @@ -1019,7 +1019,7 @@ int ExpUAbs::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpUNot::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpUNot::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; @@ -1035,7 +1035,7 @@ int ExpUNot::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpCast::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpCast::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; errors += type_->emit_def(out, empty_perm_string); @@ -1045,7 +1045,7 @@ int ExpCast::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpNew::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpNew::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0; out << "new["; @@ -1054,7 +1054,7 @@ int ExpNew::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpTime::emit(ostream&out, Entity*, ScopeBase*) +int ExpTime::emit(ostream&out, Entity*, ScopeBase*) const { out << amount_; @@ -1070,7 +1070,7 @@ int ExpTime::emit(ostream&out, Entity*, ScopeBase*) return 0; } -int ExpRange::emit(ostream&out, Entity*ent, ScopeBase*scope) +int ExpRange::emit(ostream&out, Entity*ent, ScopeBase*scope) const { int errors = 0;