Skip to content

Commit 46f2fdb

Browse files
committed
[NFC][scudo] Move macro into a shared header
1 parent 4c58f33 commit 46f2fdb

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,13 @@ template <typename Config> struct TestAllocator : scudo::Allocator<Config> {
7676
~TestAllocator() { this->unmapTestOnly(); }
7777
};
7878

79-
namespace testing {
80-
namespace internal {
81-
#define SCUDO_DEFINE_GTEST_TYPE_NAME(TYPE) \
82-
template <> std::string GetTypeName<scudo::TYPE>() { return #TYPE; }
83-
SCUDO_DEFINE_GTEST_TYPE_NAME(AndroidSvelteConfig)
79+
SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::AndroidSvelteConfig)
8480
#if SCUDO_FUCHSIA
85-
SCUDO_DEFINE_GTEST_TYPE_NAME(FuchsiaConfig)
81+
SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::FuchsiaConfig)
8682
#else
87-
SCUDO_DEFINE_GTEST_TYPE_NAME(DefaultConfig)
88-
SCUDO_DEFINE_GTEST_TYPE_NAME(AndroidConfig)
83+
SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::DefaultConfig)
84+
SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::AndroidConfig)
8985
#endif
90-
#undef SCUDO_DEFINE_GTEST_TYPE_NAME
91-
} // namespace internal
92-
} // namespace testing
9386

9487
template <class Config> struct ScudoCombinedTest : public ::testing::Test {
9588
ScudoCombinedTest() {

compiler-rt/lib/scudo/standalone/tests/primary_test.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,9 @@ struct TestAllocator : public SizeClassAllocator<BaseConfig, SizeClassMapT> {
6565
~TestAllocator() { this->unmapTestOnly(); }
6666
};
6767

68-
namespace testing {
69-
namespace internal {
70-
#define SCUDO_DEFINE_GTEST_TYPE_NAME(TYPE) \
71-
template <> std::string GetTypeName<TYPE>() { return #TYPE; }
7268
SCUDO_DEFINE_GTEST_TYPE_NAME(TestConfig1)
7369
SCUDO_DEFINE_GTEST_TYPE_NAME(TestConfig2)
7470
SCUDO_DEFINE_GTEST_TYPE_NAME(TestConfig3)
75-
#undef SCUDO_DEFINE_GTEST_TYPE_NAME
76-
} // namespace internal
77-
} // namespace testing
7871

7972
template <class BaseConfig> struct ScudoPrimaryTest : public ::testing::Test {};
8073

compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@
3232
#endif
3333

3434
extern bool UseQuarantine;
35+
36+
#define SCUDO_DEFINE_GTEST_TYPE_NAME(TYPE) \
37+
template <> std::string testing::internal::GetTypeName<TYPE>() { \
38+
return #TYPE; \
39+
}

0 commit comments

Comments
 (0)