Skip to content

Commit 13361ef

Browse files
committed
Move magic "compiled" string behind an API in symbolt
1 parent 291c525 commit 13361ef

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
@@ -707,15 +707,13 @@ void compilet::convert_symbols(goto_functionst &dest)
707707
symbol_table.symbols.find(*it);
708708
assert(s_it!=symbol_table.symbols.end());
709709

710-
if(s_it->second.type.id()==ID_code &&
711-
!s_it->second.is_macro &&
712-
!s_it->second.is_type &&
713-
s_it->second.value.id()!="compiled" &&
714-
s_it->second.value.is_not_nil())
710+
if(
711+
s_it->second.is_function() && !s_it->second.is_compiled() &&
712+
s_it->second.value.is_not_nil())
715713
{
716714
debug() << "Compiling " << s_it->first << eom;
717715
converter.convert_function(s_it->first, dest.function_map[s_it->first]);
718-
symbol_table.get_writeable_ref(*it).value=exprt("compiled");
716+
symbol_table.get_writeable_ref(*it).mark_compiled();
719717
}
720718
}
721719
}

src/goto-programs/goto_convert_functions.cpp

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

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

157157
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
@@ -845,6 +845,7 @@ IREP_ID_TWO(C_no_initialization_required, #no_initialization_required)
845845
IREP_ID_TWO(overlay_class, java::com.diffblue.OverlayClassImplementation)
846846
IREP_ID_TWO(overlay_method, java::com.diffblue.OverlayMethodImplementation)
847847
IREP_ID_ONE(annotations)
848+
IREP_ID_ONE(compiled)
848849

849850
#undef IREP_ID_ONE
850851
#undef IREP_ID_TWO

src/util/symbol.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ class symbolt
111111
{
112112
return !is_type && !is_macro && type.id()==ID_code;
113113
}
114+
115+
bool is_compiled() const
116+
{
117+
return value == exprt(ID_compiled);
118+
}
119+
120+
void mark_compiled()
121+
{
122+
value = exprt(ID_compiled);
123+
}
114124
};
115125

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

0 commit comments

Comments
 (0)