[libcxx-commits] [libcxx] [libc++] default the allocator arguemnt for most constructor (PR #169901)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 28 03:13:47 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions  -- libcxx/include/string --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/string b/libcxx/include/string
index ea90be950..133878fa2 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1070,8 +1070,8 @@ public:
   basic_string(nullptr_t) = delete;
 #  endif
 
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-  basic_string(const _CharT* __s, size_type __n, const _Allocator& __a = _Allocator())
+  _LIBCPP_HIDE_FROM_ABI
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a = _Allocator())
       _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero")
       : __alloc_(__a) {
     _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
@@ -1168,8 +1168,8 @@ public:
 #  endif
 
 #  ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-  basic_string(initializer_list<_CharT> __il, const _Allocator& __a = _Allocator())
+  _LIBCPP_HIDE_FROM_ABI
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a = _Allocator())
       : __alloc_(__a) {
     __init(__il.begin(), __il.end());
   }

``````````

</details>


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


More information about the libcxx-commits mailing list