Skip to content

Commit a1e1e32

Browse files
committed
Move magic "compiled" string behind an API in symbolt
1 parent 254b4d4 commit a1e1e32

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

src/goto-cc/compile.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -718,15 +718,13 @@ void compilet::convert_symbols(goto_functionst &dest)
718718
symbol_table.symbols.find(*it);
719719
assert(s_it!=symbol_table.symbols.end());
720720

721-
if(s_it->second.type.id()==ID_code &&
722-
!s_it->second.is_macro &&
723-
!s_it->second.is_type &&
724-
s_it->second.value.id()!="compiled" &&
725-
s_it->second.value.is_not_nil())
721+
if(
722+
s_it->second.is_function() && !s_it->second.is_compiled() &&
723+
s_it->second.value.is_not_nil())
726724
{
727725
debug() << "Compiling " << s_it->first << eom;
728726
converter.convert_function(s_it->first, dest.function_map[s_it->first]);
729-
symbol_table.get_writeable_ref(*it).value=exprt("compiled");
727+
symbol_table.get_writeable_ref(*it).mark_compiled();
730728
}
731729
}
732730
}

src/goto-programs/goto_convert_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void goto_convert_functionst::convert_function(
152152
f.type=to_code_type(symbol.type);
153153

154154
if(symbol.value.is_nil() ||
155-
symbol.value.id()=="compiled") /* goto_inline may have removed the body */
155+
symbol.is_compiled()) /* goto_inline may have removed the body */
156156
return;
157157

158158
if(symbol.value.id()!=ID_code)

src/util/irep_ids.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ IREP_ID_ONE(r_ok)
697697
IREP_ID_ONE(w_ok)
698698
IREP_ID_ONE(super_class)
699699
IREP_ID_ONE(exceptions_thrown_list)
700+
IREP_ID_ONE(compiled)
700701

701702
// Projects depending on this code base that wish to extend the list of
702703
// available ids should provide a file local_irep_ids.def in their source tree

src/util/symbol.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ class symbolt
107107
{
108108
return !is_type && !is_macro && type.id()==ID_code;
109109
}
110+
111+
bool is_compiled() const
112+
{
113+
return value == exprt(ID_compiled);
114+
}
115+
116+
void mark_compiled()
117+
{
118+
value = exprt(ID_compiled);
119+
}
110120
};
111121

112122
std::ostream &operator<<(std::ostream &out, const symbolt &symbol);

0 commit comments

Comments
 (0)