CBMC
Loading...
Searching...
No Matches
linking_class.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: ANSI-C Linking
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_LINKING_LINKING_CLASS_H
13#define CPROVER_LINKING_LINKING_CLASS_H
14
15#include <util/namespace.h>
16#include <util/rename_symbol.h>
17#include <util/std_expr.h>
18#include <util/symbol.h>
19
21
22#include <unordered_set>
23
25
27{
28public:
37
42
45
46protected:
53
55 needs_renaming_type(const symbolt &old_symbol, const symbolt &new_symbol);
56
58 needs_renaming_non_type(const symbolt &old_symbol, const symbolt &new_symbol);
59
60 renamingt needs_renaming(const symbolt &old_symbol, const symbolt &new_symbol)
61 {
62 if(new_symbol.is_type)
63 return needs_renaming_type(old_symbol, new_symbol);
64 else
65 return needs_renaming_non_type(old_symbol, new_symbol);
66 }
67
68 std::unordered_map<irep_idt, irep_idt> rename_symbols(
69 const symbol_table_baset &,
70 const std::unordered_set<irep_idt> &needs_to_be_renamed);
71 void copy_symbols(
72 const symbol_table_baset &,
73 const std::unordered_map<irep_idt, irep_idt> &);
74
76 symbolt &old_symbol,
77 symbolt &new_symbol);
78
80 symbolt &old_symbol,
81 symbolt &new_symbol);
82
84 symbolt &old_symbol,
85 symbolt &new_symbol);
86
88 const symbolt &old_symbol,
89 const symbolt &new_symbol,
90 bool &set_to_new);
91
93 {
102
106 std::unordered_set<irep_idt> o_symbols;
107 std::unordered_set<irep_idt> n_symbols;
108 };
109
111 const typet &type1,
112 const typet &type2,
114
116 symbolt &old_symbol,
117 const symbolt &new_symbol);
118
122
123 irep_idt rename(const symbol_table_baset &, const irep_idt &);
124
125 // the new IDs created by renaming
126 std::unordered_set<irep_idt> renamed_ids;
127};
128
129#endif // CPROVER_LINKING_LINKING_CLASS_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
A variant of replace_symbolt that does not require types to match, but instead inserts type casts as ...
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
std::unordered_map< irep_idt, irep_idt > rename_symbols(const symbol_table_baset &, const std::unordered_set< irep_idt > &needs_to_be_renamed)
Definition linking.cpp:952
void duplicate_non_type_symbol(symbolt &old_symbol, symbolt &new_symbol)
Definition linking.cpp:701
bool adjust_object_type(const symbolt &old_symbol, const symbolt &new_symbol, bool &set_to_new)
Definition linking.cpp:596
bool link(const symbol_table_baset &src_symbol_table)
Merges the symbol table src_symbol_table into main_symbol_table, renaming symbols from src_symbol_tab...
Definition linking.cpp:1053
renamingt needs_renaming(const symbolt &old_symbol, const symbolt &new_symbol)
linkingt(symbol_table_baset &_main_symbol_table, message_handlert &_message_handler)
namespacet ns
bool adjust_object_type_rec(const typet &type1, const typet &type2, adjust_type_infot &info)
Definition linking.cpp:401
rename_symbolt rename_main_symbol
void copy_symbols(const symbol_table_baset &, const std::unordered_map< irep_idt, irep_idt > &)
Definition linking.cpp:987
irep_idt rename(const symbol_table_baset &, const irep_idt &)
Definition linking.cpp:43
renamingt needs_renaming_type(const symbolt &old_symbol, const symbolt &new_symbol)
Definition linking.cpp:834
symbol_table_baset & main_symbol_table
renamingt needs_renaming_non_type(const symbolt &old_symbol, const symbolt &new_symbol)
Definition linking.cpp:67
void duplicate_object_symbol(symbolt &old_symbol, symbolt &new_symbol)
Definition linking.cpp:611
casting_replace_symbolt object_type_updates
std::unordered_set< irep_idt > renamed_ids
void duplicate_type_symbol(symbolt &old_symbol, const symbolt &new_symbol)
Definition linking.cpp:744
rename_symbolt rename_new_symbol
void duplicate_code_symbol(symbolt &old_symbol, symbolt &new_symbol)
Definition linking.cpp:82
message_handlert & message_handler
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
The symbol table base class interface.
Symbol table entry.
Definition symbol.h:28
bool is_type
Definition symbol.h:61
The type of an expression, extends irept.
Definition type.h:29
API to expression classes.
adjust_type_infot(const symbolt &_old_symbol, const symbolt &_new_symbol)
std::unordered_set< irep_idt > o_symbols
std::unordered_set< irep_idt > n_symbols
Symbol table entry.