[llvm] [llvm] Fixed Demangle OutputBuffer (PR #138564)

Dmitry Vasilyev via llvm-commits llvm-commits at lists.llvm.org
Mon May 5 13:12:06 PDT 2025


slydiman wrote:

> I guess the problem was that we were passing `memcpy` the pointer `&*R.begin()`, which might be null if the `string_view` is empty?

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xstring
```
template <class _Traits>
class _String_view_iterator {
public:
    _NODISCARD constexpr reference operator*() const noexcept {
#if _ITERATOR_DEBUG_LEVEL >= 1
        _STL_VERIFY(_Mydata, "cannot dereference value-initialized string_view iterator");
        _STL_VERIFY(_Myoff < _Mysize, "cannot dereference end string_view iterator");  // <<< EXCEPTION HERE
        return _Mydata[_Myoff];
#else // ^^^ _ITERATOR_DEBUG_LEVEL >= 1 / _ITERATOR_DEBUG_LEVEL == 0 vvv
        return *_Myptr;
#endif // ^^^ _ITERATOR_DEBUG_LEVEL == 0 ^^^
    }
```

https://github.com/llvm/llvm-project/pull/138564


More information about the llvm-commits mailing list