[llvm] [libc++][hardening] Rework macros for enabling the hardening mode. (PR #70575)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 28 14:54:20 PDT 2023
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 e00d32afb9d33a1eca48e2b041c9688436706c5b 26bbe1cf58df8abfc0eb24ce7e6492d47fe515c2 -- libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp libcxx/include/__algorithm/three_way_comp_ref_type.h libcxx/test/libcxx/odr_signature.hardening.sh.cpp libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.verify.cpp libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp b/libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp
index ad3f7ca2a150..26ba47e9ba84 100644
--- a/libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/debug_lite.pass.cpp
@@ -21,9 +21,7 @@
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire");
- }(), "Should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp
index 32f6a9008962..93a123f99488 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_debug_lite_mode.pass.cpp
@@ -21,9 +21,9 @@
int main(int, char**) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Debug-lite-mode assertions should fire");
- }(), "Debug-lite-mode assertions should fire");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ [] { _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Debug-lite-mode assertions should fire"); }(),
+ "Debug-lite-mode assertions should fire");
_LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not fire");
return 0;
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
index caf28371f0a5..41c9870bc921 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
@@ -21,9 +21,8 @@
int main(int, char**) {
_LIBCPP_ASSERT_INTERNAL(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should fire");
- }(), "Debug-mode assertions should fire");
+ TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should fire"); }(),
+ "Debug-mode assertions should fire");
return 0;
}
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
index 3f38b368aef4..5d1cb1dcccaf 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_hardened_mode.pass.cpp
@@ -21,9 +21,9 @@
int main(int, char**) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
- TEST_LIBCPP_ASSERT_FAILURE([] {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Hardened-mode assertions should fire");
- }(), "Hardened-mode assertions should fire");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ [] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Hardened-mode assertions should fire"); }(),
+ "Hardened-mode assertions should fire");
_LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not fire");
return 0;
``````````
</details>
https://github.com/llvm/llvm-project/pull/70575
More information about the llvm-commits
mailing list