cprover
cpp_typecheck_fargs.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C++ Language Type Checking
4 
5 Author: Daniel Kroening, kroening@cs.cmu.edu
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_CPP_CPP_TYPECHECK_FARGS_H
13 #define CPROVER_CPP_CPP_TYPECHECK_FARGS_H
14 
15 #include <util/std_code.h>
16 
17 class cpp_typecheckt;
18 class code_typet;
19 
20 class cpp_typecheck_fargst // for function overloading
21 {
22 public:
25 
26  // has_object indicates that the first element of
27  // 'operands' is the 'this' pointer (with the object type,
28  // not pointer to object type)
29 
30  cpp_typecheck_fargst():in_use(false), has_object(false) { }
31 
32  bool has_class_type() const;
33 
34  void build(
35  const side_effect_expr_function_callt &function_call);
36 
38  const side_effect_expr_function_callt &function_call):
39  in_use(false), has_object(false)
40  {
41  build(function_call);
42  }
43 
44  bool match(
45  const code_typet &code_type,
46  unsigned &distance,
48 
49  void add_object(const exprt &expr)
50  {
51  // if(!in_use) return;
52  has_object=true;
53  operands.insert(operands.begin(), expr);
54  }
55 
57  {
58  assert(has_object);
59  operands.erase(operands.begin());
60  has_object = false;
61  }
62 };
63 
64 #endif // CPROVER_CPP_CPP_TYPECHECK_FARGS_H
cpp_typecheck_fargst
Definition: cpp_typecheck_fargs.h:21
cpp_typecheck_fargst::cpp_typecheck_fargst
cpp_typecheck_fargst(const side_effect_expr_function_callt &function_call)
Definition: cpp_typecheck_fargs.h:37
side_effect_expr_function_callt
A side_effect_exprt representation of a function call side effect.
Definition: std_code.h:2140
cpp_typecheck_fargst::match
bool match(const code_typet &code_type, unsigned &distance, cpp_typecheckt &cpp_typecheck) const
Definition: cpp_typecheck_fargs.cpp:38
cpp_typecheck_fargst::operands
exprt::operandst operands
Definition: cpp_typecheck_fargs.h:24
exprt
Base class for all expressions.
Definition: expr.h:54
cpp_typecheck_fargst::cpp_typecheck_fargst
cpp_typecheck_fargst()
Definition: cpp_typecheck_fargs.h:30
cpp_typecheck
bool cpp_typecheck(cpp_parse_treet &cpp_parse_tree, symbol_tablet &symbol_table, const std::string &module, message_handlert &message_handler)
Definition: cpp_typecheck.cpp:89
cpp_typecheck_fargst::has_object
bool has_object
Definition: cpp_typecheck_fargs.h:23
cpp_typecheck_fargst::build
void build(const side_effect_expr_function_callt &function_call)
Definition: cpp_typecheck_fargs.cpp:31
cpp_typecheck_fargst::in_use
bool in_use
Definition: cpp_typecheck_fargs.h:23
code_typet
Base type of functions.
Definition: std_types.h:533
cpp_typecheckt
Definition: cpp_typecheck.h:45
exprt::operandst
std::vector< exprt > operandst
Definition: expr.h:56
cpp_typecheck_fargst::add_object
void add_object(const exprt &expr)
Definition: cpp_typecheck_fargs.h:49
cpp_typecheck_fargst::remove_object
void remove_object()
Definition: cpp_typecheck_fargs.h:56
std_code.h
cpp_typecheck_fargst::has_class_type
bool has_class_type() const
Definition: cpp_typecheck_fargs.cpp:20