CBMC
Loading...
Searching...
No Matches
java_expr.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Java-specific exprt subclasses
4
5Author: Diffblue Ltd
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_JAVA_BYTECODE_JAVA_EXPR_H
13#define CPROVER_JAVA_BYTECODE_JAVA_EXPR_H
14
15#include <util/std_expr.h>
16
18{
19public:
27
28 const exprt &tested_expr() const
29 {
30 return op0();
31 }
33 {
34 return op0();
35 }
36
38 {
39 return to_struct_tag_type(op1().type());
40 }
41
42 static void check(
43 const exprt &expr,
45 {
47 }
48
49 static void validate(
50 const exprt &expr,
51 const namespacet &ns,
53 {
55
56 const auto &expr_binary = static_cast<const binary_predicate_exprt &>(expr);
57
59 vm,
61 "java_instanceof_exprt rhs should be a type_exprt");
63 vm,
65 "java_instanceof_exprt rhs should denote a struct_tag_typet");
66 }
67};
68
69template <>
71{
72 return can_cast_expr<binary_exprt>(base) && base.id() == ID_java_instanceof;
73}
74
75inline void validate_expr(const java_instanceof_exprt &value)
76{
78}
79
87{
90 return static_cast<const java_instanceof_exprt &>(expr);
91}
92
100
101#endif // CPROVER_JAVA_BYTECODE_JAVA_EXPR_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
exprt & lhs()
Definition std_expr.h:668
exprt & op0()
Definition expr.h:133
exprt & op1()
Definition expr.h:136
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly two argu...
Definition std_expr.h:731
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:738
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:745
Base class for all expressions.
Definition expr.h:56
typet & type()
Return the type of the expression.
Definition expr.h:84
const irep_idt & id() const
Definition irep.h:388
exprt & tested_expr()
Definition java_expr.h:32
java_instanceof_exprt(exprt lhs, const struct_tag_typet &target_type)
Definition java_expr.h:20
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition java_expr.h:49
const exprt & tested_expr() const
Definition java_expr.h:28
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition java_expr.h:42
const struct_tag_typet & target_type() const
Definition java_expr.h:37
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
A struct tag type, i.e., struct_typet with an identifier.
Definition std_types.h:493
An expression denoting a type.
Definition std_expr.h:3081
bool can_cast_expr< java_instanceof_exprt >(const exprt &base)
Definition java_expr.h:70
void validate_expr(const java_instanceof_exprt &value)
Definition java_expr.h:75
const java_instanceof_exprt & to_java_instanceof_expr(const exprt &expr)
Cast an exprt to a java_instanceof_exprt.
Definition java_expr.h:86
STL namespace.
#define PRECONDITION(CONDITION)
Definition invariant.h:463
API to expression classes.
bool can_cast_expr< binary_exprt >(const exprt &base)
Definition std_expr.h:699
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
Definition std_types.h:518
#define DATA_CHECK(vm, condition, message)
This macro takes a condition which denotes a well-formedness criterion on goto programs,...
Definition validate.h:22
validation_modet