ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
pad_names.h
Go to the documentation of this file.
1#ifndef ESBMC_UTIL_IREP_PAD_NAMES_H
2#define ESBMC_UTIL_IREP_PAD_NAMES_H
3
4#include <string_view>
5#include <util/base/prefix.h>
6
7/* Names of the synthetic members add_padding() inserts into struct/union types.
8 * They contain '#', which no C or C++ identifier may contain -- unlike '$',
9 * which clang accepts in identifiers by default -- so a declared member can
10 * never collide with one (esbmc/esbmc#1476). Collisions are not merely
11 * cosmetic: struct_union_get_component_number() resolves a member by name and
12 * yields nothing when the name is ambiguous. */
13inline constexpr std::string_view pad_prefix = "anon_pad#";
14inline constexpr std::string_view pad_bit_field_prefix = "anon_bit_field_pad#";
15inline constexpr std::string_view pad_ext_int_prefix = "ext_int_pad#";
16inline constexpr std::string_view pad_union_name = "union_pad#";
17
18inline bool is_padding_name(std::string_view name)
19{
20 return has_prefix(name, pad_prefix) ||
23}
24
25#endif
bool is_padding_name(std::string_view name)
Definition pad_names.h:18
constexpr std::string_view pad_bit_field_prefix
Definition pad_names.h:14
constexpr std::string_view pad_union_name
Definition pad_names.h:16
constexpr std::string_view pad_ext_int_prefix
Definition pad_names.h:15
constexpr std::string_view pad_prefix
Definition pad_names.h:13
bool has_prefix(std::string_view s, std::string_view prefix)
Definition prefix.h:6