CBMC
rewrite_index.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Pointer Dereferencing
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #include "rewrite_index.h"
13 
14 #include <util/pointer_expr.h>
15 #include <util/std_expr.h>
16 
19 {
20  dereference_exprt result(
21  plus_exprt(index_expr.array(), index_expr.index()), index_expr.type());
22  result.add_source_location()=index_expr.source_location();
23  return result;
24 }
rewrite_index.h
dereference_exprt
Operator to dereference a pointer.
Definition: pointer_expr.h:659
plus_exprt
The plus expression Associativity is not specified.
Definition: std_expr.h:946
exprt::type
typet & type()
Return the type of the expression.
Definition: expr.h:84
pointer_expr.h
index_exprt::index
exprt & index()
Definition: std_expr.h:1450
index_exprt::array
exprt & array()
Definition: std_expr.h:1440
rewrite_index
dereference_exprt rewrite_index(const index_exprt &index_expr)
rewrite a[i] to *(a+i)
Definition: rewrite_index.cpp:18
index_exprt
Array index operator.
Definition: std_expr.h:1409
exprt::add_source_location
source_locationt & add_source_location()
Definition: expr.h:216
std_expr.h
exprt::source_location
const source_locationt & source_location() const
Definition: expr.h:211