[libcxx-commits] [libcxx] [libc++][NFC] Format new.ipp (PR #215792)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 12 05:47:47 PDT 2026
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/215792
`.ipp` files aren't checked by the formatting CI, so this wasn't
noticed originally.
>From fea7aada0086bd0abf479c54122019843f3bb0c7 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 12 Aug 2026 14:46:07 +0200
Subject: [PATCH] [libc++][NFC] Format new.ipp
`.ipp` files aren't checked by the formatting CI, so this wasn't
noticed originally.
---
libcxx/src/support/new.ipp | 44 +++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/libcxx/src/support/new.ipp b/libcxx/src/support/new.ipp
index 451f3c153fa23..80be2d904af4c 100644
--- a/libcxx/src/support/new.ipp
+++ b/libcxx/src/support/new.ipp
@@ -47,8 +47,8 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {
}
[[gnu::weak]] void* operator new(size_t size, const std::nothrow_t&) noexcept {
-# if !_LIBCPP_HAS_EXCEPTIONS
-# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+#if !_LIBCPP_HAS_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
_LIBCPP_ASSERT_SHIM(
(!std::__is_function_overridden < void*(std::size_t), &operator new>()),
"libc++ was configured with exceptions disabled and `operator new(size_t)` has been overridden, "
@@ -57,24 +57,24 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {
"it fails to allocate, making it impossible for `operator new(size_t, nothrow_t)` to fulfill its "
"contract (since it should return nullptr upon failure). Please make sure you override "
"`operator new(size_t, nothrow_t)` as well.");
-# endif
+# endif
return operator_new_impl(size);
-# else
+#else
void* p = nullptr;
try {
p = ::operator new(size);
} catch (...) {
}
return p;
-# endif
+#endif
}
OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }
[[gnu::weak]] void* operator new[](size_t size, const std::nothrow_t&) noexcept {
-# if !_LIBCPP_HAS_EXCEPTIONS
-# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+#if !_LIBCPP_HAS_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
_LIBCPP_ASSERT_SHIM(
(!std::__is_function_overridden < void*(std::size_t), &operator new[]>()),
"libc++ was configured with exceptions disabled and `operator new[](size_t)` has been overridden, "
@@ -83,17 +83,17 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return
"it fails to allocate, making it impossible for `operator new[](size_t, nothrow_t)` to fulfill its "
"contract (since it should return nullptr upon failure). Please make sure you override "
"`operator new[](size_t, nothrow_t)` as well.");
-# endif
+# endif
return operator_new_impl(size);
-# else
+#else
void* p = nullptr;
try {
p = ::operator new[](size);
} catch (...) {
}
return p;
-# endif
+#endif
}
[[gnu::weak]] void operator delete(void* ptr) noexcept { std::free(ptr); }
@@ -108,7 +108,7 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return
[[gnu::weak]] void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }
-# if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
+#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignment) {
if (size == 0)
@@ -138,8 +138,8 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align
}
[[gnu::weak]] void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
-# if !_LIBCPP_HAS_EXCEPTIONS
-# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+# if !_LIBCPP_HAS_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
_LIBCPP_ASSERT_SHIM(
(!std::__is_function_overridden < void*(std::size_t, std::align_val_t), &operator new>()),
"libc++ was configured with exceptions disabled and `operator new(size_t, align_val_t)` has been overridden, "
@@ -148,17 +148,17 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align
"terminate in case it fails to allocate, making it impossible for `operator new(size_t, align_val_t, nothrow_t)` "
"to fulfill its contract (since it should return nullptr upon failure). Please make sure you override "
"`operator new(size_t, align_val_t, nothrow_t)` as well.");
-# endif
+# endif
return operator_new_aligned_impl(size, alignment);
-# else
+# else
void* p = nullptr;
try {
p = ::operator new(size, alignment);
} catch (...) {
}
return p;
-# endif
+# endif
}
OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
@@ -166,8 +166,8 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen
}
[[gnu::weak]] void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
-# if !_LIBCPP_HAS_EXCEPTIONS
-# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+# if !_LIBCPP_HAS_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
_LIBCPP_ASSERT_SHIM(
(!std::__is_function_overridden < void*(std::size_t, std::align_val_t), &operator new[]>()),
"libc++ was configured with exceptions disabled and `operator new[](size_t, align_val_t)` has been overridden, "
@@ -176,17 +176,17 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen
"terminate in case it fails to allocate, making it impossible for `operator new[](size_t, align_val_t, "
"nothrow_t)` to fulfill its contract (since it should return nullptr upon failure). Please make sure you "
"override `operator new[](size_t, align_val_t, nothrow_t)` as well.");
-# endif
+# endif
return operator_new_aligned_impl(size, alignment);
-# else
+# else
void* p = nullptr;
try {
p = ::operator new[](size, alignment);
} catch (...) {
}
return p;
-# endif
+# endif
}
[[gnu::weak]] void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }
@@ -210,4 +210,4 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen
[[gnu::weak]] void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept {
::operator delete[](ptr, alignment);
}
-# endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
+#endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
More information about the libcxx-commits
mailing list