[libcxx-commits] [libcxx] [libcxx] Improve handling of DummyData blocks in libcxx tests (PR #88897)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 16 07:08:27 PDT 2024
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 36b3c26451bf9a42f0b6b415993d3942bb73abdd e32c5912ca34bccc43dfaaafddd827078adffb01 -- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.indirect.pass.cpp libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.pass.cpp libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align_nothrow.replace.indirect.pass.cpp libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.replace.pass.cpp libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.indirect.pass.cpp libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.indirect.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.indirect.pass.cpp
index 1ccf5501bc..df397fa0d3 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.indirect.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.indirect.pass.cpp
@@ -52,7 +52,7 @@ int main(int, char**) {
{
new_called = delete_called = 0;
OverAligned* dummy_data_block = new (std::nothrow) OverAligned;
- OverAligned* x = DoNotOptimize(dummy_data_block);
+ OverAligned* x = DoNotOptimize(dummy_data_block);
ASSERT_WITH_OPERATOR_NEW_FALLBACKS(static_cast<void*>(x) == DummyData);
ASSERT_WITH_OPERATOR_NEW_FALLBACKS(new_called == 1);
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.pass.cpp
index bdfed1bd8a..278d7801b3 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.pass.cpp
@@ -27,20 +27,17 @@
#include "test_macros.h"
#include "../types.h"
-class Data{
+class Data {
public:
- Data() = default;
- ~Data() = default;
+ Data() = default;
+ ~Data() = default;
- char *getDummyData() {
- return this->dummy_data_;
- }
+ char* getDummyData() { return this->dummy_data_; }
+
+ std::size_t getDummyDataSize() { return sizeof(this->dummy_data_); }
- std::size_t getDummyDataSize() {
- return sizeof(this->dummy_data_);
- }
private:
- alignas(OverAligned) char dummy_data_[alignof(OverAligned) * 3];
+ alignas(OverAligned) char dummy_data_[alignof(OverAligned) * 3];
};
int new_called = 0;
@@ -48,10 +45,10 @@ int delete_called = 0;
Data data_class;
void* operator new[](std::size_t s, std::align_val_t a) {
- assert(s <= data_class.getDummyDataSize());
- assert(static_cast<std::size_t>(a) == alignof(OverAligned));
- ++new_called;
- return data_class.getDummyData();
+ assert(s <= data_class.getDummyDataSize());
+ assert(static_cast<std::size_t>(a) == alignof(OverAligned));
+ ++new_called;
+ return data_class.getDummyData();
}
void operator delete[](void*, std::align_val_t) noexcept {
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align_nothrow.replace.indirect.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align_nothrow.replace.indirect.pass.cpp
index 6c12a9b65f..4085e92642 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align_nothrow.replace.indirect.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align_nothrow.replace.indirect.pass.cpp
@@ -56,7 +56,7 @@ int main(int, char**) {
{
new_called = delete_called = 0;
OverAligned* dummy_data_block = new (std::nothrow) OverAligned[3];
- OverAligned* x = DoNotOptimize(dummy_data_block);
+ OverAligned* x = DoNotOptimize(dummy_data_block);
ASSERT_WITH_OPERATOR_NEW_FALLBACKS(static_cast<void*>(x) == DummyData);
ASSERT_WITH_OPERATOR_NEW_FALLBACKS(new_called == 1);
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.replace.pass.cpp
index 254b864a74..82fdcb6a3e 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.replace.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.replace.pass.cpp
@@ -27,20 +27,17 @@
#include "test_macros.h"
#include "../types.h"
-class Data{
+class Data {
public:
- Data() = default;
- ~Data() = default;
+ Data() = default;
+ ~Data() = default;
- char *getDummyData() {
- return this->dummy_data_;
- }
+ char* getDummyData() { return this->dummy_data_; }
+
+ std::size_t getDummyDataSize() { return sizeof(this->dummy_data_); }
- std::size_t getDummyDataSize() {
- return sizeof(this->dummy_data_);
- }
private:
- alignas(OverAligned) char dummy_data_[alignof(OverAligned)];
+ alignas(OverAligned) char dummy_data_[alignof(OverAligned)];
};
int new_called = 0;
@@ -48,10 +45,10 @@ int delete_called = 0;
Data data_class;
void* operator new(std::size_t s, std::align_val_t a) {
- assert(s <= data_class.getDummyDataSize());
- assert(static_cast<std::size_t>(a) == alignof(OverAligned));
- ++new_called;
- return data_class.getDummyData();
+ assert(s <= data_class.getDummyDataSize());
+ assert(static_cast<std::size_t>(a) == alignof(OverAligned));
+ ++new_called;
+ return data_class.getDummyData();
}
void operator delete(void*, std::align_val_t) noexcept {
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.indirect.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.indirect.pass.cpp
index df0c454ecd..543ab76d4e 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.indirect.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.indirect.pass.cpp
@@ -55,7 +55,7 @@ int main(int, char**) {
{
new_called = delete_called = 0;
OverAligned* dummy_data_block = new (std::nothrow) OverAligned;
- OverAligned* x = DoNotOptimize(dummy_data_block);
+ OverAligned* x = DoNotOptimize(dummy_data_block);
ASSERT_WITH_OPERATOR_NEW_FALLBACKS(static_cast<void*>(x) == DummyData);
ASSERT_WITH_OPERATOR_NEW_FALLBACKS(new_called == 1);
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.pass.cpp
index 5e7f2523de..60ace3582b 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.pass.cpp
@@ -26,20 +26,17 @@
#include "test_macros.h"
#include "../types.h"
-class Data{
+class Data {
public:
- Data() = default;
- ~Data() = default;
+ Data() = default;
+ ~Data() = default;
- char *getDummyData() {
- return this->dummy_data_;
- }
+ char* getDummyData() { return this->dummy_data_; }
+
+ std::size_t getDummyDataSize() { return sizeof(this->dummy_data_); }
- std::size_t getDummyDataSize() {
- return sizeof(this->dummy_data_);
- }
private:
- alignas(OverAligned) char dummy_data_[alignof(OverAligned)];
+ alignas(OverAligned) char dummy_data_[alignof(OverAligned)];
};
int new_nothrow_called = 0;
@@ -47,10 +44,10 @@ int delete_called = 0;
Data data_class;
void* operator new(std::size_t s, std::align_val_t a, std::nothrow_t const&) noexcept {
- assert(s <= data_class.getDummyDataSize());
- assert(static_cast<std::size_t>(a) == alignof(OverAligned));
- ++new_nothrow_called;
- return data_class.getDummyData();
+ assert(s <= data_class.getDummyDataSize());
+ assert(static_cast<std::size_t>(a) == alignof(OverAligned));
+ ++new_nothrow_called;
+ return data_class.getDummyData();
}
void operator delete(void*, std::align_val_t) noexcept {
``````````
</details>
https://github.com/llvm/llvm-project/pull/88897
More information about the libcxx-commits
mailing list