CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
literal_expr.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9
10#ifndef CPROVER_SOLVERS_PROP_LITERAL_EXPR_H
11#define CPROVER_SOLVERS_PROP_LITERAL_EXPR_H
12
13#include <util/std_expr.h>
14
15#include "literal.h"
16
18{
19public:
25
27 {
28 literalt result;
30 return result;
31 }
32
34 {
35 set(ID_literal, a.get());
36 }
37};
38
39template <>
40inline bool can_cast_expr<literal_exprt>(const exprt &base)
41{
42 return base.id() == ID_literal;
43}
44
46{
48 !literal.has_operands(), "literal expression should not have operands");
49}
50
56inline const literal_exprt &to_literal_expr(const exprt &expr)
57{
58 PRECONDITION(expr.id() == ID_literal);
60 !expr.has_operands(), "literal expression should not have operands");
61 return static_cast<const literal_exprt &>(expr);
62}
63
67{
68 PRECONDITION(expr.id() == ID_literal);
70 !expr.has_operands(), "literal expression should not have operands");
71 return static_cast<literal_exprt &>(expr);
72}
73
74#endif // CPROVER_SOLVERS_PROP_LITERAL_EXPR_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Base class for all expressions.
Definition expr.h:56
bool has_operands() const
Return true if there is at least one operand.
Definition expr.h:91
void set(const irep_idt &name, const irep_idt &value)
Definition irep.h:412
long long get_long_long(const irep_idt &name) const
Definition irep.cpp:72
const irep_idt & id() const
Definition irep.h:388
literal_exprt(literalt a)
literalt get_literal() const
void set_literal(literalt a)
void set(var_not _l)
Definition literal.h:93
A base class for expressions that are predicates, i.e., Boolean-typed.
Definition std_expr.h:574
const literal_exprt & to_literal_expr(const exprt &expr)
Cast a generic exprt to a literal_exprt.
void validate_expr(const literal_exprt &literal)
bool can_cast_expr< literal_exprt >(const exprt &base)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
Definition invariant.h:534
#define PRECONDITION(CONDITION)
Definition invariant.h:463
API to expression classes.