@@ -27,24 +27,22 @@ std::ostream &operator << (std::ostream &out, cpp_scopet::lookup_kindt kind)
27
27
}
28
28
29
29
void cpp_scopet::lookup_rec (
30
- const irep_idt &base_name ,
30
+ const irep_idt &base_name_to_lookup ,
31
31
lookup_kindt kind,
32
32
id_sett &id_set)
33
33
{
34
- cpp_id_mapt::iterator
35
- lower_it=sub.lower_bound (base_name);
34
+ cpp_id_mapt::iterator lower_it = sub.lower_bound (base_name_to_lookup);
36
35
37
36
if (lower_it!=sub.end ())
38
37
{
39
- cpp_id_mapt::iterator
40
- upper_it=sub.upper_bound (base_name);
38
+ cpp_id_mapt::iterator upper_it = sub.upper_bound (base_name_to_lookup);
41
39
42
40
for (cpp_id_mapt::iterator n_it=lower_it;
43
41
n_it!=upper_it; n_it++)
44
42
id_set.insert (&n_it->second );
45
43
}
46
44
47
- if (this -> base_name ==base_name )
45
+ if (base_name == base_name_to_lookup )
48
46
id_set.insert (this );
49
47
50
48
if (kind==SCOPE_ONLY)
@@ -57,7 +55,7 @@ void cpp_scopet::lookup_rec(
57
55
58
56
// Recursive call.
59
57
// Note the different kind!
60
- other_scope.lookup_rec (base_name , QUALIFIED, id_set);
58
+ other_scope.lookup_rec (base_name_to_lookup , QUALIFIED, id_set);
61
59
}
62
60
63
61
if (!id_set.empty ())
@@ -70,7 +68,7 @@ void cpp_scopet::lookup_rec(
70
68
71
69
// Recursive call.
72
70
// Note the different kind!
73
- other_scope.lookup_rec (base_name , QUALIFIED, id_set);
71
+ other_scope.lookup_rec (base_name_to_lookup , QUALIFIED, id_set);
74
72
}
75
73
76
74
if (kind==QUALIFIED)
@@ -81,44 +79,41 @@ void cpp_scopet::lookup_rec(
81
79
82
80
// ask parent, recursive call
83
81
if (!is_root_scope ())
84
- get_parent ().lookup_rec (base_name , kind, id_set);
82
+ get_parent ().lookup_rec (base_name_to_lookup , kind, id_set);
85
83
}
86
84
87
85
void cpp_scopet::lookup_rec (
88
- const irep_idt &base_name ,
86
+ const irep_idt &base_name_to_lookup ,
89
87
lookup_kindt kind,
90
- cpp_idt::id_classt id_class ,
88
+ cpp_idt::id_classt identifier_class ,
91
89
id_sett &id_set)
92
90
{
93
91
// we have a hack to do full search in case we
94
92
// are looking for templates!
95
93
96
94
#if 0
97
- std::cout << "B: " << base_name << '\n';
95
+ std::cout << "B: " << base_name_to_lookup << '\n';
98
96
std::cout << "K: " << kind << '\n';
99
- std::cout << "I: " << id_class << '\n';
100
- std::cout << "THIS: " << this-> base_name << " " << this->id_class
97
+ std::cout << "I: " << identifier_class << '\n';
98
+ std::cout << "THIS: " << base_name << " " << identifier_class
101
99
<< " " << this->identifier << '\n';
102
100
#endif
103
101
104
- cpp_id_mapt::iterator
105
- lower_it=sub.lower_bound (base_name);
102
+ cpp_id_mapt::iterator lower_it = sub.lower_bound (base_name_to_lookup);
106
103
107
104
if (lower_it!=sub.end ())
108
105
{
109
- cpp_id_mapt::iterator
110
- upper_it=sub.upper_bound (base_name);
106
+ cpp_id_mapt::iterator upper_it = sub.upper_bound (base_name_to_lookup);
111
107
112
108
for (cpp_id_mapt::iterator n_it=lower_it;
113
109
n_it!=upper_it; n_it++)
114
110
{
115
- if (n_it->second .id_class == id_class )
111
+ if (n_it->second .id_class == identifier_class )
116
112
id_set.insert (&n_it->second );
117
113
}
118
114
}
119
115
120
- if (this ->base_name == base_name &&
121
- this ->id_class == id_class)
116
+ if (base_name == base_name_to_lookup && id_class == identifier_class)
122
117
id_set.insert (this );
123
118
124
119
if (kind==SCOPE_ONLY)
@@ -131,10 +126,11 @@ void cpp_scopet::lookup_rec(
131
126
132
127
// Recursive call.
133
128
// Note the different kind!
134
- other_scope.lookup_rec (base_name, QUALIFIED, id_class, id_set);
129
+ other_scope.lookup_rec (
130
+ base_name_to_lookup, QUALIFIED, identifier_class, id_set);
135
131
}
136
132
137
- if (!id_set.empty () && id_class != id_classt::TEMPLATE)
133
+ if (!id_set.empty () && identifier_class != id_classt::TEMPLATE)
138
134
return ; // done, upwards scopes are hidden
139
135
140
136
// secondary scopes
@@ -144,44 +140,48 @@ void cpp_scopet::lookup_rec(
144
140
145
141
// Recursive call.
146
142
// Note the different kind!
147
- other_scope.lookup_rec (base_name, QUALIFIED, id_class, id_set);
143
+ other_scope.lookup_rec (
144
+ base_name_to_lookup, QUALIFIED, identifier_class, id_set);
148
145
}
149
146
150
147
if (kind==QUALIFIED)
151
148
return ; // done
152
149
153
- if (!id_set.empty () &&
154
- id_class!=id_classt::TEMPLATE) return ; // done, upwards scopes are hidden
150
+ if (!id_set.empty () && identifier_class != id_classt::TEMPLATE)
151
+ return ; // done, upwards scopes are hidden
155
152
156
153
// ask parent, recursive call
157
154
if (!is_root_scope ())
158
- get_parent ().lookup_rec (base_name, kind, id_class, id_set);
155
+ get_parent ().lookup_rec (
156
+ base_name_to_lookup, kind, identifier_class, id_set);
159
157
}
160
158
161
159
cpp_scopet::id_sett cpp_scopet::lookup_identifier (
162
- const irep_idt &identifier ,
163
- cpp_idt::id_classt id_class )
160
+ const irep_idt &id ,
161
+ cpp_idt::id_classt identifier_class )
164
162
{
165
163
id_sett id_set;
166
164
167
165
for (cpp_id_mapt::iterator n_it=sub.begin ();
168
166
n_it!=sub.end (); n_it++)
169
167
{
170
- if (n_it->second .identifier == identifier
171
- && n_it->second .id_class == id_class)
172
- id_set.insert (&n_it->second );
168
+ if (
169
+ n_it->second .identifier == id &&
170
+ n_it->second .id_class == identifier_class)
171
+ {
172
+ id_set.insert (&n_it->second );
173
+ }
173
174
}
174
175
175
- if (this ->identifier == identifier
176
- && this ->id_class == id_class)
176
+ if (identifier == id && id_class == identifier_class)
177
177
id_set.insert (this );
178
178
179
179
#if 0
180
180
for(std::size_t i=0; i<parents_size(); i++)
181
181
{
182
182
cpp_idt &parent= get_parent(i);
183
- if(parent.identifier == identifier
184
- && parent.id_class == id_class )
183
+ if(parent.identifier == id
184
+ && parent.id_class == identifier_class )
185
185
id_set.insert(&parent);
186
186
}
187
187
#endif
@@ -200,7 +200,7 @@ cpp_scopet &cpp_scopet::new_scope(const irep_idt &new_scope_name)
200
200
return (cpp_scopet &)id;
201
201
}
202
202
203
- bool cpp_scopet::contains (const irep_idt &base_name )
203
+ bool cpp_scopet::contains (const irep_idt &base_name_to_lookup )
204
204
{
205
- return !lookup (base_name , SCOPE_ONLY).empty ();
205
+ return !lookup (base_name_to_lookup , SCOPE_ONLY).empty ();
206
206
}
0 commit comments