[libcxx-commits] [libcxx] [libcxx] Remove TODO related to dead_on_return (PR #194264)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 26 13:05:22 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Aiden Grossman (boomanaiden154)

<details>
<summary>Changes</summary>

dead_on_return is now implemented, so remove the TODO. Still reset the buffer with __uninitialized_tag however, as it does not seem to have any adverse effects and caught something like 10-20 use-after-destroys when using msan in our internal code base.

---
Full diff: https://github.com/llvm/llvm-project/pull/194264.diff


1 Files Affected:

- (modified) libcxx/include/string (-3) 


``````````diff
diff --git a/libcxx/include/string b/libcxx/include/string
index 0c8767df2cdd2..6913e7d8cfe27 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1184,9 +1184,6 @@ public:
   }
 #  endif // _LIBCPP_CXX03_LANG
 
-  // TODO(boomanaiden154): Once we mark this in destructors as dead on return,
-  // we can use a normal call to __reset_internal_buffer and remove the extra
-  // __rep constructor.
   inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() { __reset_internal_buffer(__rep(__uninitialized_tag())); }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view() const _NOEXCEPT {

``````````

</details>


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


More information about the libcxx-commits mailing list