[libcxx-commits] [libcxx] [libc++] Simplify the __libcpp_refstring implementation (PR #166344)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 4 02:20:31 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 ,h -- libcxx/include/stdexcept libcxx/src/include/refstring.h --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/src/include/refstring.h b/libcxx/src/include/refstring.h
index 3c7c5cc5b..acc11b25e 100644
--- a/libcxx/src/include/refstring.h
+++ b/libcxx/src/include/refstring.h
@@ -27,7 +27,7 @@ struct __libcpp_refstring::__rep {
 inline __libcpp_refstring::__libcpp_refstring(const char* msg) {
   std::size_t len = strlen(msg);
   auto* rep       = static_cast<__rep*>(::operator new(sizeof(__rep) + len + 1));
-  rep->refcount      = 0;
+  rep->refcount   = 0;
   std::memcpy(rep->data, msg, len + 1);
   __imp_ = rep;
 }

``````````

</details>


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


More information about the libcxx-commits mailing list