Skip to content

Commit d6f42d5

Browse files
committed
Converting exprt to c code without padding and struct declaration
1 parent 77185fd commit d6f42d5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/ansi-c/expr2c.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,3 +3961,18 @@ std::string type2c(const typet &type, const namespacet &ns)
39613961
// expr2c.get_shorthands(expr);
39623962
return expr2c.convert(type);
39633963
}
3964+
3965+
std::string expr2c_pretty_structt::convert_struct_type(
3966+
const typet &src,
3967+
const std::string &qualifiers_str,
3968+
const std::string &declarator_str)
3969+
{
3970+
return expr2ct::convert_struct_type(
3971+
src, qualifiers_str, declarator_str, false, false);
3972+
}
3973+
3974+
std::string
3975+
expr2c_pretty_structt::convert_struct(const exprt &src, unsigned &precedence)
3976+
{
3977+
return expr2ct::convert_struct(src, precedence, false);
3978+
}

src/ansi-c/expr2c_class.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,19 @@ class expr2ct
256256
bool include_padding_components);
257257
};
258258

259+
class expr2c_pretty_structt : public expr2ct
260+
{
261+
public:
262+
explicit expr2c_pretty_structt(const namespacet &_ns) : expr2ct(_ns)
263+
{
264+
}
265+
266+
protected:
267+
std::string convert_struct(const exprt &src, unsigned &precedence) override;
268+
std::string convert_struct_type(
269+
const typet &src,
270+
const std::string &qualifiers_str,
271+
const std::string &declarator_str) override;
272+
};
273+
259274
#endif // CPROVER_ANSI_C_EXPR2C_CLASS_H

0 commit comments

Comments
 (0)