@@ -1227,6 +1227,9 @@ class compound_type : public type
12271227 string *name);
12281228
12291229 string *get_name () const { return m_name; }
1230+ void set_name (const char *new_name) {
1231+ m_name = m_ctxt->new_string (new_name);
1232+ }
12301233 location *get_loc () const { return m_loc; }
12311234 fields * get_fields () { return m_fields; }
12321235
@@ -1500,6 +1503,10 @@ class lvalue : public rvalue
15001503 void set_alignment (unsigned bytes);
15011504 unsigned get_alignment () const { return m_alignment; }
15021505 virtual string * get_name () const { return NULL ; }
1506+ virtual void set_name (const char *new_name) {
1507+ m_ctxt->add_error (
1508+ NULL , " cannot change the name of type %s" , m_type->get_debug_string ());
1509+ }
15031510
15041511protected:
15051512 string *m_link_section;
@@ -1541,6 +1548,9 @@ class param : public lvalue
15411548 const char *access_as_lvalue (reproducer &r) final override ;
15421549
15431550 string * get_name () const final override { return m_name; }
1551+ void set_name (const char *new_name) final override {
1552+ m_name = m_ctxt->new_string (new_name);
1553+ }
15441554
15451555private:
15461556 string * make_debug_string () final override { return m_name; }
@@ -1594,6 +1604,9 @@ class function : public memento
15941604 void set_loc (location * loc) { m_loc = loc; }
15951605 type *get_return_type () const { return m_return_type; }
15961606 string * get_name () const { return m_name; }
1607+ void set_name (const char *new_name) {
1608+ m_name = m_ctxt->new_string (new_name);
1609+ }
15971610 const vec<param *> &get_params () const { return m_params; }
15981611
15991612 /* Get the given param by index.
@@ -1811,6 +1824,9 @@ class global : public lvalue
18111824 void set_rvalue_init (rvalue *val) { m_rvalue_init = val; }
18121825
18131826 string * get_name () const final override { return m_name; }
1827+ void set_name (const char *new_name) final override {
1828+ m_name = m_ctxt->new_string (new_name);
1829+ }
18141830
18151831private:
18161832 string * make_debug_string () final override { return m_name; }
0 commit comments