cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
rename.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
#include "
rename.h
"
10
11
#include <string>
12
13
#include "
namespace.h
"
14
15
irep_idt
16
get_new_name
(
const
irep_idt
&name,
const
namespacet
&ns,
char
delimiter)
17
{
18
const
symbolt
*symbol;
19
if
(ns.
lookup
(name, symbol))
20
return
name;
21
22
std::string prefix =
id2string
(name) + delimiter;
23
24
return
prefix + std::to_string(ns.
smallest_unused_suffix
(prefix));
25
}
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
namespacet::lookup
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
Definition
namespace.cpp:134
namespacet::smallest_unused_suffix
std::size_t smallest_unused_suffix(const std::string &prefix) const override
See documentation for namespace_baset::smallest_unused_suffix().
Definition
namespace.cpp:116
symbolt
Symbol table entry.
Definition
symbol.h:28
id2string
const std::string & id2string(const irep_idt &d)
Definition
irep.h:44
namespace.h
get_new_name
irep_idt get_new_name(const irep_idt &name, const namespacet &ns, char delimiter)
Build and identifier not yet present in the namespace ns based on name.
Definition
rename.cpp:16
rename.h
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
util
rename.cpp
Generated by
1.17.0