[libcxx-commits] [PATCH] D82221: Add optimization to basic_string::assign for compile-time known constant values.

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 19 13:37:05 PDT 2020


EricWF accepted this revision.
EricWF added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libcxx/include/string:2504
     _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr");
-    return assign(__s, traits_type::length(__s));
+    return _LIBCPP_BUILTIN_CONSTANT_P(*__s)
+               ? (traits_type::length(__s) < __min_cap
----------------
A brief comment here would be appreciated as to what the "_LIBCPP_BUILTIN_CONSTANT_P` magic is doing here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82221





More information about the libcxx-commits mailing list