Skip to content

Commit 6b88028

Browse files
committed
remove code formatting from format_expr
This code is not used; goto_programt::output_instructoin implements its own logic for printing goto instructions.
1 parent 3d1e3fb commit 6b88028

File tree

2 files changed

+0
-58
lines changed

2 files changed

+0
-58
lines changed

src/util/format_expr.cpp

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ Author: Daniel Kroening, [email protected]
1414
#include "arith_tools.h"
1515
#include "byte_operators.h"
1616
#include "format_type.h"
17-
#include "goto_instruction_code.h"
1817
#include "ieee_float.h"
1918
#include "mathematical_expr.h"
2019
#include "mp_arith.h"
2120
#include "pointer_expr.h"
2221
#include "prefix.h"
23-
#include "std_code.h"
2422
#include "string_utils.h"
2523

2624
#include <map>
@@ -425,53 +423,6 @@ void format_expr_configt::setup()
425423
<< format(if_expr.false_case()) << ')';
426424
};
427425

428-
expr_map[ID_code] =
429-
[](std::ostream &os, const exprt &expr) -> std::ostream & {
430-
const auto &code = to_code(expr);
431-
const irep_idt &statement = code.get_statement();
432-
433-
if(statement == ID_assign)
434-
return os << format(to_code_assign(code).lhs()) << " = "
435-
<< format(to_code_assign(code).rhs()) << ';';
436-
else if(statement == ID_block)
437-
{
438-
os << '{';
439-
for(const auto &s : to_code_block(code).statements())
440-
os << ' ' << format(s);
441-
return os << " }";
442-
}
443-
else if(statement == ID_dead)
444-
{
445-
return os << "dead " << format(to_code_dead(code).symbol()) << ";";
446-
}
447-
else if(const auto decl = expr_try_dynamic_cast<code_frontend_declt>(code))
448-
{
449-
const auto &declaration_symb = decl->symbol();
450-
os << "decl " << format(declaration_symb.type()) << " "
451-
<< format(declaration_symb);
452-
if(const optionalt<exprt> initial_value = decl->initial_value())
453-
os << " = " << format(*initial_value);
454-
return os << ";";
455-
}
456-
else if(statement == ID_function_call)
457-
{
458-
const auto &func_call = to_code_function_call(code);
459-
os << to_symbol_expr(func_call.function()).get_identifier() << "(";
460-
461-
// Join all our arguments together.
462-
join_strings(
463-
os,
464-
func_call.arguments().begin(),
465-
func_call.arguments().end(),
466-
", ",
467-
[](const exprt &expr) { return format(expr); });
468-
469-
return os << ");";
470-
}
471-
else
472-
return fallback_format_rec(os, expr);
473-
};
474-
475426
expr_map[ID_string_constant] =
476427
[](std::ostream &os, const exprt &expr) -> std::ostream & {
477428
return os << '"' << expr.get_string(ID_value) << '"';

unit/util/format.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,3 @@
1212
#include <util/std_code.h>
1313

1414
#include <testing-utils/use_catch.h>
15-
16-
TEST_CASE("Format a declaration statement.", "[core][util][format]")
17-
{
18-
const signedbv_typet int_type{32};
19-
code_frontend_declt declaration{symbol_exprt{"foo", int_type}};
20-
REQUIRE(format_to_string(declaration) == "decl signedbv[32] foo;");
21-
declaration.set_initial_value({int_type.zero_expr()});
22-
REQUIRE(format_to_string(declaration) == "decl signedbv[32] foo = 0;");
23-
}

0 commit comments

Comments
 (0)