Skip to content

Commit fe52899

Browse files
committed
Rename SUB_IS_LIST define to NAMED_SUB_IS_FORWARD_LIST
As suggested in code review.
1 parent f9b4d9e commit fe52899

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

src/util/irep.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Author: Daniel Kroening, [email protected]
1717
#include "string_hash.h"
1818
#include "irep_hash.h"
1919

20-
#ifdef SUB_IS_LIST
20+
#ifdef NAMED_SUB_IS_FORWARD_LIST
2121
#include <algorithm>
2222
#endif
2323

@@ -31,7 +31,7 @@ irept nil_rep_storage;
3131
irept::dt irept::empty_d;
3232
#endif
3333

34-
#ifdef SUB_IS_LIST
34+
#ifdef NAMED_SUB_IS_FORWARD_LIST
3535
static inline bool named_subt_order(
3636
const std::pair<irep_namet, irept> &a,
3737
const irep_namet &b)
@@ -203,7 +203,7 @@ const irep_idt &irept::get(const irep_namet &name) const
203203
{
204204
const named_subt &s = get_named_sub();
205205

206-
#ifdef SUB_IS_LIST
206+
#ifdef NAMED_SUB_IS_FORWARD_LIST
207207
named_subt::const_iterator it=named_subt_lower_bound(s, name);
208208

209209
if(it==s.end() ||
@@ -259,7 +259,7 @@ void irept::remove(const irep_namet &name)
259259
{
260260
named_subt &s = get_named_sub();
261261

262-
#ifdef SUB_IS_LIST
262+
#ifdef NAMED_SUB_IS_FORWARD_LIST
263263
named_subt::iterator it=named_subt_lower_bound(s, name);
264264

265265
if(it!=s.end() && it->first==name)
@@ -278,7 +278,7 @@ const irept &irept::find(const irep_namet &name) const
278278
{
279279
const named_subt &s = get_named_sub();
280280

281-
#ifdef SUB_IS_LIST
281+
#ifdef NAMED_SUB_IS_FORWARD_LIST
282282
named_subt::const_iterator it=named_subt_lower_bound(s, name);
283283

284284
if(it==s.end() ||
@@ -298,7 +298,7 @@ irept &irept::add(const irep_namet &name)
298298
{
299299
named_subt &s = get_named_sub();
300300

301-
#ifdef SUB_IS_LIST
301+
#ifdef NAMED_SUB_IS_FORWARD_LIST
302302
named_subt::iterator it=named_subt_lower_bound(s, name);
303303

304304
if(it==s.end() ||
@@ -320,7 +320,7 @@ irept &irept::add(const irep_namet &name, const irept &irep)
320320
{
321321
named_subt &s = get_named_sub();
322322

323-
#ifdef SUB_IS_LIST
323+
#ifdef NAMED_SUB_IS_FORWARD_LIST
324324
named_subt::iterator it=named_subt_lower_bound(s, name);
325325

326326
if(it==s.end() ||
@@ -425,7 +425,7 @@ bool irept::full_eq(const irept &other) const
425425
const irept::named_subt &i1_named_sub=get_named_sub();
426426
const irept::named_subt &i2_named_sub=other.get_named_sub();
427427

428-
#ifdef SUB_IS_LIST
428+
#ifdef NAMED_SUB_IS_FORWARD_LIST
429429
if(
430430
i1_sub.size() != i2_sub.size() ||
431431
std::distance(i1_named_sub.begin(), i1_named_sub.end()) !=
@@ -692,7 +692,7 @@ std::size_t irept::full_hash() const
692692
result=hash_combine(result, it->second.full_hash());
693693
}
694694

695-
#ifdef SUB_IS_LIST
695+
#ifdef NAMED_SUB_IS_FORWARD_LIST
696696
const std::size_t named_sub_size =
697697
std::distance(named_sub.begin(), named_sub.end());
698698
#else

src/util/irep.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ Author: Daniel Kroening, [email protected]
2020
#define SHARING
2121
// #define HASH_CODE
2222
#define USE_MOVE
23-
// #define SUB_IS_LIST
23+
// #define NAMED_SUB_IS_FORWARD_LIST
2424

25-
#ifdef SUB_IS_LIST
25+
#ifdef NAMED_SUB_IS_FORWARD_LIST
2626
#include <forward_list>
2727
#else
2828
#include <map>
@@ -160,7 +160,7 @@ class irept
160160
// use std::forward_list or std::vector< unique_ptr<T> > to save
161161
// memory and increase efficiency.
162162

163-
#ifdef SUB_IS_LIST
163+
#ifdef NAMED_SUB_IS_FORWARD_LIST
164164
typedef std::forward_list<std::pair<irep_namet, irept>> named_subt;
165165
#else
166166
typedef std::map<irep_namet, irept> named_subt;

src/util/irep_hash_container.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void irep_hash_container_baset::pack(
5454
{
5555
// we pack: the irep id, the sub size, the subs, the named-sub size, and
5656
// each of the named subs with their ids
57-
#ifdef SUB_IS_LIST
57+
#ifdef NAMED_SUB_IS_FORWARD_LIST
5858
const std::size_t named_sub_size =
5959
std::distance(named_sub.begin(), named_sub.end());
6060
#else

src/util/lispirep.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void irep2lisp(const irept &src, lispexprt &dest)
4646
dest.value="";
4747
dest.type=lispexprt::List;
4848

49-
#ifdef SUB_IS_LIST
49+
#ifdef NAMED_SUB_IS_FORWARD_LIST
5050
const std::size_t named_sub_size =
5151
std::distance(src.get_named_sub().begin(), src.get_named_sub().end());
5252
#else

src/util/merge_irep.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ std::size_t to_be_merged_irept::hash() const
2828
result, static_cast<const merged_irept &>(it->second).hash());
2929
}
3030

31-
#ifdef SUB_IS_LIST
31+
#ifdef NAMED_SUB_IS_FORWARD_LIST
3232
const std::size_t named_sub_size =
3333
std::distance(named_sub.begin(), named_sub.end());
3434
#else
@@ -51,7 +51,7 @@ bool to_be_merged_irept::operator == (const to_be_merged_irept &other) const
5151

5252
if(sub.size()!=o_sub.size())
5353
return false;
54-
#ifdef SUB_IS_LIST
54+
#ifdef NAMED_SUB_IS_FORWARD_LIST
5555
if(
5656
std::distance(named_sub.begin(), named_sub.end()) !=
5757
std::distance(o_named_sub.begin(), o_named_sub.end()))
@@ -110,12 +110,12 @@ const merged_irept &merged_irepst::merged(const irept &irep)
110110
const irept::named_subt &src_named_sub=irep.get_named_sub();
111111
irept::named_subt &dest_named_sub=new_irep.get_named_sub();
112112

113-
#ifdef SUB_IS_LIST
113+
#ifdef NAMED_SUB_IS_FORWARD_LIST
114114
irept::named_subt::iterator before = dest_named_sub.before_begin();
115115
#endif
116116
forall_named_irep(it, src_named_sub)
117117
{
118-
#ifdef SUB_IS_LIST
118+
#ifdef NAMED_SUB_IS_FORWARD_LIST
119119
dest_named_sub.emplace_after(
120120
before, it->first, merged(it->second)); // recursive call
121121
++before;
@@ -161,12 +161,12 @@ const irept &merge_irept::merged(const irept &irep)
161161
const irept::named_subt &src_named_sub=irep.get_named_sub();
162162
irept::named_subt &dest_named_sub=new_irep.get_named_sub();
163163

164-
#ifdef SUB_IS_LIST
164+
#ifdef NAMED_SUB_IS_FORWARD_LIST
165165
irept::named_subt::iterator before = dest_named_sub.before_begin();
166166
#endif
167167
forall_named_irep(it, src_named_sub)
168168
{
169-
#ifdef SUB_IS_LIST
169+
#ifdef NAMED_SUB_IS_FORWARD_LIST
170170
dest_named_sub.emplace_after(
171171
before, it->first, merged(it->second)); // recursive call
172172
++before;
@@ -204,12 +204,12 @@ const irept &merge_full_irept::merged(const irept &irep)
204204
const irept::named_subt &src_named_sub=irep.get_named_sub();
205205
irept::named_subt &dest_named_sub=new_irep.get_named_sub();
206206

207-
#ifdef SUB_IS_LIST
207+
#ifdef NAMED_SUB_IS_FORWARD_LIST
208208
irept::named_subt::iterator before = dest_named_sub.before_begin();
209209
#endif
210210
forall_named_irep(it, src_named_sub)
211211
{
212-
#ifdef SUB_IS_LIST
212+
#ifdef NAMED_SUB_IS_FORWARD_LIST
213213
dest_named_sub.emplace_after(
214214
before, it->first, merged(it->second)); // recursive call
215215
++before;

unit/util/irep.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ SCENARIO("irept_memory", "[core][utils][irept]")
3535
REQUIRE(sizeof(std::vector<int>) == 3 * sizeof(void *));
3636
#endif
3737

38-
#ifndef SUB_IS_LIST
38+
#ifndef NAMED_SUB_IS_FORWARD_LIST
3939
const std::size_t named_size = sizeof(std::map<int, int>);
4040
# ifndef _GLIBCXX_DEBUG
4141
# ifdef __APPLE__

0 commit comments

Comments
 (0)