Skip to content

Commit 1a87168

Browse files
committed
fixup! use getters for string internals
1 parent 8d0245d commit 1a87168

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
@@ -184,40 +184,50 @@ template <class _CharT, class _Traits, class _Allocator> class basic_string {
184184
};
185185
};
186186

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

199209
public:
200210
template <size_t __N>
201211
basic_string(unsigned char __size, const value_type (&__data)[__N]) {
202212
static_assert(__N < __min_cap, "");
203213
#ifdef BITMASKS
204-
__R_S.__size_ = __size << __short_shift;
214+
getShortRep().__size_ = __size << __short_shift;
205215
#else
206-
__R_S.__size_ = __size;
207-
__R_S.__is_long_ = false;
216+
getShortRep().__size_ = __size;
217+
getShortRep().__is_long_ = false;
208218
#endif
209219
for (size_t __i = 0; __i < __N; ++__i)
210-
__R_S.__data_[__i] = __data[__i];
220+
getShortRep().__data_[__i] = __data[__i];
211221
}
212222
basic_string(size_t __cap, size_type __size, pointer __data) {
213223
#ifdef BITMASKS
214-
__R_L.__cap_ = __cap | __long_mask;
224+
getLongRep().__cap_ = __cap | __long_mask;
215225
#else
216-
__R_L.__cap_ = __cap / __endian_factor;
217-
__R_L.__is_long_ = true;
226+
getLongRep().__cap_ = __cap / __endian_factor;
227+
getLongRep().__is_long_ = true;
218228
#endif
219-
__R_L.__size_ = __size;
220-
__R_L.__data_ = __data;
229+
getLongRep().__size_ = __size;
230+
getLongRep().__data_ = __data;
221231
}
222232
};
223233

0 commit comments

Comments
 (0)