Skip to content

Commit 8d162bb

Browse files
committed
Remove base_name, replace display_name
1 parent 0aa666e commit 8d162bb

File tree

3 files changed

+16
-26
lines changed

3 files changed

+16
-26
lines changed

src/ansi-c/ansi_c_declaration.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ void ansi_c_declarationt::to_symbol(
131131
symbol.value=declarator.value();
132132
symbol.type=full_type(declarator);
133133
symbol.name=declarator.get_name();
134-
symbol.pretty_name=symbol.name;
135-
symbol.base_name=declarator.get_base_name();
134+
symbol.display_name=declarator.get_base_name();
136135
symbol.is_type=get_is_typedef();
137136
symbol.location=declarator.source_location();
138137
symbol.is_extern=get_is_extern();

src/util/symbol.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ void symbolt::show(std::ostream &out) const
6060
out << " volatile";
6161
if(!mode.empty())
6262
out << " mode=" << mode;
63-
if(!base_name.empty())
64-
out << " base_name=" << base_name;
6563
if(!module.empty())
6664
out << " module=" << module;
67-
if(!pretty_name.empty())
68-
out << " pretty_name=" << pretty_name;
65+
if(!display_name.empty())
66+
out << " display_name=" << display_name;
6967
out << '\n';
7068
out << " location: " << location << '\n';
7169

@@ -92,9 +90,8 @@ void symbolt::swap(symbolt &b)
9290
SYM_SWAP1(type);
9391
SYM_SWAP1(value);
9492
SYM_SWAP1(name);
95-
SYM_SWAP1(pretty_name);
93+
SYM_SWAP1(display_name);
9694
SYM_SWAP1(module);
97-
SYM_SWAP1(base_name);
9895
SYM_SWAP1(mode);
9996
SYM_SWAP1(location);
10097

@@ -142,10 +139,7 @@ bool symbolt::is_well_formed() const
142139
// to have it's base name as a suffix to it's more
143140
// general name.
144141

145-
// Exception: Java symbols' base names do not have type signatures
146-
// (for example, they can have name "someclass.method:(II)V" and base name
147-
// "method")
148-
if(!has_suffix(id2string(name), id2string(base_name)) && mode != ID_java)
142+
if(!has_suffix(id2string(name), id2string(display_name)))
149143
{
150144
bool criterion_must_hold = true;
151145

@@ -168,6 +162,13 @@ bool symbolt::is_well_formed() const
168162
criterion_must_hold = false;
169163
}
170164
}
165+
// Exception: Java symbols' base names do not have type signatures
166+
// (for example, they can have name "someclass.method:(II)V" and base name
167+
// "method")
168+
else if(mode == ID_java)
169+
{
170+
return id2string(name).find(id2string(display_name)) != std::string::npos;
171+
}
171172

172173
// Linker renaming may have added $linkN suffixes to the name, and other
173174
// suffixes such as #return_value may have then be subsequently added.
@@ -210,9 +211,8 @@ bool symbolt::operator==(const symbolt &other) const
210211
location == other.location &&
211212
name == other.name &&
212213
module == other.module &&
213-
base_name == other.base_name &&
214214
mode == other.mode &&
215-
pretty_name == other.pretty_name &&
215+
display_name == other.display_name &&
216216
is_type == other.is_type &&
217217
is_macro == other.is_macro &&
218218
is_exported == other.is_exported &&

src/util/symbol.h

+3-12
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,11 @@ class symbolt
4242
/// Name of module the symbol belongs to
4343
irep_idt module;
4444

45-
/// Base (non-scoped) name
46-
irep_idt base_name;
47-
4845
/// Language mode
4946
irep_idt mode;
5047

5148
/// Language-specific display name
52-
irep_idt pretty_name;
53-
54-
/// Return language specific display name if present.
55-
const irep_idt &display_name() const
56-
{
57-
return pretty_name.empty()?name:pretty_name;
58-
}
49+
irep_idt display_name;
5950

6051
// global use
6152
bool is_type, is_macro, is_exported,
@@ -78,7 +69,7 @@ class symbolt
7869
value.make_nil();
7970
location.make_nil();
8071

81-
name=module=base_name=mode=pretty_name=irep_idt();
72+
name=module=mode=display_name=irep_idt();
8273

8374
is_type = is_macro = is_exported = is_input = is_output = is_state_var =
8475
is_property = is_static_lifetime = is_thread_local = is_lvalue =
@@ -159,7 +150,7 @@ class auxiliary_symbolt:public symbolt
159150
auxiliary_symbolt()
160151
{
161152
this->name=name;
162-
this->base_name=name;
153+
this->display_name = name;
163154
this->type=type;
164155
}
165156
};

0 commit comments

Comments
 (0)