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 <cassert>
16 
17 #include <util/std_code.h>
18 
19 class cpp_typecheckt;
20 class code_typet;
21 
22 class cpp_typecheck_fargst // for function overloading
23 {
24 public:
27 
28  // has_object indicates that the first element of
29  // 'operands' is the 'this' pointer (with the object type,
30  // not pointer to object type)
31 
32  cpp_typecheck_fargst():in_use(false), has_object(false) { }
33 
34  bool has_class_type() const;
35 
36  void build(
37  const side_effect_expr_function_callt &function_call);
38 
40  const side_effect_expr_function_callt &function_call):
41  in_use(false), has_object(false)
42  {
43  build(function_call);
44  }
45 
46  bool match(
47  const code_typet &code_type,
48  unsigned &distance,
50 
51  void add_object(const exprt &expr)
52  {
53  // if(!in_use) return;
54  has_object=true;
55  operands.insert(operands.begin(), expr);
56  }
57 
59  {
60  assert(has_object);
61  operands.erase(operands.begin());
62  has_object = false;
63  }
64 };
65 
66 #endif // CPROVER_CPP_CPP_TYPECHECK_FARGS_H
cpp_typecheck_fargst
Definition: cpp_typecheck_fargs.h:23
cpp_typecheck_fargst::cpp_typecheck_fargst
cpp_typecheck_fargst(const side_effect_expr_function_callt &function_call)
Definition: cpp_typecheck_fargs.h:39
side_effect_expr_function_callt
A side_effect_exprt representation of a function call side effect.
Definition: std_code.h:2117
cpp_typecheck_fargst::match
bool match(const code_typet &code_type, unsigned &distance, cpp_typecheckt &cpp_typecheck) const
Definition: cpp_typecheck_fargs.cpp:40
cpp_typecheck_fargst::operands
exprt::operandst operands
Definition: cpp_typecheck_fargs.h:26
exprt
Base class for all expressions.
Definition: expr.h:53
cpp_typecheck_fargst::cpp_typecheck_fargst
cpp_typecheck_fargst()
Definition: cpp_typecheck_fargs.h:32
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:25
cpp_typecheck_fargst::build
void build(const side_effect_expr_function_callt &function_call)
Definition: cpp_typecheck_fargs.cpp:33
cpp_typecheck_fargst::in_use
bool in_use
Definition: cpp_typecheck_fargs.h:25
code_typet
Base type of functions.
Definition: std_types.h:736
cpp_typecheckt
Definition: cpp_typecheck.h:45
exprt::operandst
std::vector< exprt > operandst
Definition: expr.h:55
cpp_typecheck_fargst::add_object
void add_object(const exprt &expr)
Definition: cpp_typecheck_fargs.h:51
cpp_typecheck_fargst::remove_object
void remove_object()
Definition: cpp_typecheck_fargs.h:58
std_code.h
cpp_typecheck_fargst::has_class_type
bool has_class_type() const
Definition: cpp_typecheck_fargs.cpp:22