cprover
Loading...
Searching...
No Matches
does_remove_const.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Analyses
4
5Author: Diffblue Ltd.
6
7\*******************************************************************/
10
11#ifndef CPROVER_ANALYSES_DOES_REMOVE_CONST_H
12#define CPROVER_ANALYSES_DOES_REMOVE_CONST_H
13
14#include <utility>
15
16class goto_programt;
17class namespacet;
18class exprt;
20class typet;
21
23{
24public:
26 std::pair<bool, source_locationt> operator()() const;
27
28private:
29 bool does_expr_lose_const(const exprt &expr) const;
30
32 const typet &type_more_const, const typet &type_compare) const;
33
35 const typet *target_type, const typet *source_type) const;
36
38 const namespacet &ns;
39
41};
42
43#endif // CPROVER_ANALYSES_DOES_REMOVE_CONST_H
bool is_type_at_least_as_const_as(const typet &type_more_const, const typet &type_compare) const
A simple check to check the type_more_const is at least as const as type compare.
friend class does_remove_const_testt
bool does_type_preserve_const_correctness(const typet *target_type, const typet *source_type) const
A recursive check that handles when assigning a source value to a target, is the assignment a loss of...
std::pair< bool, source_locationt > operator()() const
A naive analysis to look for casts that remove const-ness from pointers.
const goto_programt & goto_program
bool does_expr_lose_const(const exprt &expr) const
Search the expression tree to look for any children that have the same base type, but a less strict c...
const namespacet & ns
Base class for all expressions.
Definition: expr.h:54
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:73
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:91
The type of an expression, extends irept.
Definition: type.h:29