Skip to content

Commit 0906d07

Browse files
committed
fixup! use getters for string internals
1 parent 709c7c2 commit 0906d07

File tree

1 file changed

+25
-15
lines changed
  • lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string

1 file changed

+25
-15
lines changed

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,40 +183,50 @@ template <class _CharT, class _Traits, class _Allocator> class basic_string {
183183
};
184184
};
185185

186+
__long &getLongRep() {
187+
#if COMPRESSED_PAIR_REV == 0
188+
return __r_.first().__l
189+
#elif COMPRESSED_PAIR_REV <= 2
190+
return __rep_.__l;
191+
#endif
192+
}
193+
194+
__short &getShortRep() {
195+
#if COMPRESSED_PAIR_REV == 0
196+
return __r_.first().__s
197+
#elif COMPRESSED_PAIR_REV <= 2
198+
return __rep_.__s;
199+
#endif
200+
}
201+
186202
#if COMPRESSED_PAIR_REV == 0
187203
std::__lldb::__compressed_pair<__rep, allocator_type> __r_;
188-
#define __R_ __r_
189-
#define __R_L __r_.first().__l
190-
#define __R_S __r_.first().__s
191204
#elif COMPRESSED_PAIR_REV <= 2
192205
_LLDB_COMPRESSED_PAIR(__rep, __rep_, allocator_type, __alloc_);
193-
#define __R_ __rep_
194-
#define __R_L __rep_.__l
195-
#define __R_S __rep_.__s
196206
#endif
197207

198208
public:
199209
template <size_t __N>
200210
basic_string(unsigned char __size, const value_type (&__data)[__N]) {
201211
static_assert(__N < __min_cap, "");
202212
#ifdef BITMASKS
203-
__R_S.__size_ = __size << __short_shift;
213+
getShortRep().__size_ = __size << __short_shift;
204214
#else
205-
__R_S.__size_ = __size;
206-
__R_S.__is_long_ = false;
215+
getShortRep().__size_ = __size;
216+
getShortRep().__is_long_ = false;
207217
#endif
208218
for (size_t __i = 0; __i < __N; ++__i)
209-
__R_S.__data_[__i] = __data[__i];
219+
getShortRep().__data_[__i] = __data[__i];
210220
}
211221
basic_string(size_t __cap, size_type __size, pointer __data) {
212222
#ifdef BITMASKS
213-
__R_L.__cap_ = __cap | __long_mask;
223+
getLongRep().__cap_ = __cap | __long_mask;
214224
#else
215-
__R_L.__cap_ = __cap / __endian_factor;
216-
__R_L.__is_long_ = true;
225+
getLongRep().__cap_ = __cap / __endian_factor;
226+
getLongRep().__is_long_ = true;
217227
#endif
218-
__R_L.__size_ = __size;
219-
__R_L.__data_ = __data;
228+
getLongRep().__size_ = __size;
229+
getLongRep().__data_ = __data;
220230
}
221231
};
222232

0 commit comments

Comments
 (0)