[libcxx-commits] [PATCH] D88849: [libc++] Make sure __clear_and_shrink() maintains string invariants

Vedant Kumar via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 5 14:36:06 PDT 2020


vsk added a comment.

Looks reasonable to me, but I'm not comfortable lgtm'ing as I know too little about the string ABI.

It's interesting that UBSan flagged the issue. What diagnostic did you see?



================
Comment at: libcxx/include/string:3962
         __set_short_size(0);
+        traits_type::assign(*__get_short_pointer(), value_type());
     }
----------------
__invariants checks that `data()[0] == value_type(0)` -- is this guaranteed to be equal to `value_type()`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88849/new/

https://reviews.llvm.org/D88849



More information about the libcxx-commits mailing list