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