27 for(scopest::const_reverse_iterator it=
scopes.rbegin();
31 scopet::name_mapt::const_iterator n_it=
32 it->name_map.find(scope_name);
34 if(n_it!=it->name_map.end())
36 identifier=n_it->second.prefixed_name;
37 return n_it->second.id_class;
47 i.
id_class=ansi_c_id_classt::ANSI_C_TAG;
51 return ansi_c_id_classt::ANSI_C_TAG;
55 return ansi_c_id_classt::ANSI_C_UNKNOWN;
60 const std::string scope_name=
65 if(prefixed_name!=tag.
get(ID_identifier))
70 identifier.
id_class=ansi_c_id_classt::ANSI_C_TAG;
72 tag.
set(ID_identifier, prefixed_name);
93 new_declarator.
build(declarator);
104 ansi_c_declaration.
declarators().push_back(new_declarator);
113 if(!base_name.
empty())
119 bool force_root_scope=
false;
123 if(new_declarator.
type().
id()==ID_code &&
126 force_root_scope=
true;
130 force_root_scope=
true;
133 ansi_c_id_classt::ANSI_C_TYPEDEF:
134 ansi_c_id_classt::ANSI_C_SYMBOL;
140 irep_idt prefixed_name=force_root_scope?
143 new_declarator.
set_name(prefixed_name);
154 ansi_c_declaration.
declarators().push_back(new_declarator);
159 if(type.
id()==ID_typedef)
160 return ansi_c_id_classt::ANSI_C_TYPEDEF;
161 else if(type.
id()==ID_struct ||
162 type.
id()==ID_union ||
163 type.
id()==ID_c_enum)
164 return ansi_c_id_classt::ANSI_C_TAG;
165 else if(type.
id()==ID_merged_type)
168 if(
get_class(*it)==ansi_c_id_classt::ANSI_C_TYPEDEF)
169 return ansi_c_id_classt::ANSI_C_TYPEDEF;
174 return ansi_c_id_classt::ANSI_C_SYMBOL;