[libcxx-commits] [libcxx] [libcxxabi] [libc++] Add __checked_int and replace uses of the overflow builtins with it (PR #234585)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 22 04:24:23 PDT 2026


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,cpp -- libcxx/include/__utility/checked_int.h libcxx/include/__charconv/from_chars_integral.h libcxx/include/__charconv/traits.h libcxx/include/__locale_dir/num.h libcxx/include/__mdspan/layout_left.h libcxx/include/__mdspan/layout_right.h libcxx/include/__mdspan/layout_stride.h libcxx/include/__mdspan/mdspan.h libcxx/include/__memory/shared_ptr.h libcxx/include/__numeric/gcd_lcm.h libcxx/include/__numeric/saturation_arithmetic.h libcxx/include/fstream libcxxabi/src/cxa_vector.cpp --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/__locale_dir/num.h b/libcxx/include/__locale_dir/num.h
index 923cf074e..e23ef75bb 100644
--- a/libcxx/include/__locale_dir/num.h
+++ b/libcxx/include/__locale_dir/num.h
@@ -574,7 +574,7 @@ protected:
         __offset -= 6;
       if (__offset >= __base)
         break;
-      __val = (__val * __base) + static_cast<unsigned short>(__offset);
+      __val        = (__val * __base) + static_cast<unsigned short>(__offset);
       __parsed_num = true;
       ++__dc;
     }
diff --git a/libcxxabi/src/cxa_vector.cpp b/libcxxabi/src/cxa_vector.cpp
index 156c8654b..3eaca6e2b 100644
--- a/libcxxabi/src/cxa_vector.cpp
+++ b/libcxxabi/src/cxa_vector.cpp
@@ -13,9 +13,9 @@
 #include "cxxabi.h"
 #include "__cxxabi_config.h"
 
-#include <exception>        // for std::terminate
-#include <new>              // for std::bad_array_new_length
 #include <__utility/checked_int.h>
+#include <exception> // for std::terminate
+#include <new>       // for std::bad_array_new_length
 
 #include "abort_message.h"
 

``````````

</details>


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


More information about the libcxx-commits mailing list