29 for(scopest::const_reverse_iterator it=
scopes.rbegin();
33 scopet::name_mapt::const_iterator n_it=
34 it->name_map.find(scope_name);
36 if(n_it!=it->name_map.end())
38 assert(
id2string(n_it->second.prefixed_name)==
39 it->prefix+id2string(scope_name));
40 identifier=n_it->second.prefixed_name;
41 return n_it->second.id_class;
64 const std::string scope_name=
69 if(prefixed_name!=tag.
get(ID_identifier))
76 tag.
set(ID_identifier, prefixed_name);
97 new_declarator.
build(declarator);
101 bool is_member=ansi_c_declaration.get_is_member();
102 bool is_parameter=ansi_c_declaration.get_is_parameter();
108 ansi_c_declaration.declarators().push_back(new_declarator);
114 ansi_c_declaration.set_is_global(
true);
117 if(!base_name.
empty())
121 bool is_extern=c_storage_spec.is_extern;
123 bool force_root_scope=
false;
127 if(new_declarator.
type().
id()==ID_code &&
130 force_root_scope=
true;
134 force_root_scope=
true;
144 irep_idt prefixed_name=force_root_scope?
147 new_declarator.
set_name(prefixed_name);
155 ansi_c_declaration.declarators().push_back(new_declarator);
160 if(type.
id()==ID_typedef)
162 else if(type.
id()==ID_struct ||
163 type.
id()==ID_union ||
164 type.
id()==ID_c_enum)
166 else if(type.
id()==ID_merged_type)
The type of an expression.
#define forall_subtypes(it, type)
const std::string & id2string(const irep_idt &d)
static ansi_c_id_classt get_class(const typet &type)
int yyansi_cerror(const std::string &error)
void add_tag_with_body(irept &tag)
ansi_c_id_classt id_class
void parse_error(const std::string &message, const std::string &before)
const irep_idt & id() const
void set_name(const irep_idt &name)
irep_idt get_base_name() const
const irep_idt & get(const irep_namet &name) const
void add_declarator(exprt &declaration, irept &declarator)
Base class for tree-like data structures with sharing.
Base class for all expressions.
ansi_c_parsert ansi_c_parser
const std::string & get_string(const irep_namet &name) const
ansi_c_declarationt & to_ansi_c_declaration(exprt &expr)
const typet & subtype() const
void set(const irep_namet &name, const irep_idt &value)
ansi_c_id_classt lookup(const irep_idt &base_name, irep_idt &identifier, bool tag, bool label)