From 3ce07499113fba01c756231fdee656e033093c27 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Wed, 5 Sep 2018 16:03:21 +0000 Subject: [XRay] Use a function to return a constant We do this instead of using static constexpr char arrays because MSVC 2015 cannot handle the constant initialisation of those along with the out-of-line storage declaration. This is a follow-up to D51672. llvm-svn: 341479 --- llvm/unittests/XRay/FDRRecordPrinterTest.cpp | 34 ++++++++++++---------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'llvm/unittests/XRay/FDRRecordPrinterTest.cpp') diff --git a/llvm/unittests/XRay/FDRRecordPrinterTest.cpp b/llvm/unittests/XRay/FDRRecordPrinterTest.cpp index e479d1219e9..f4cebf8d1f4 100644 --- a/llvm/unittests/XRay/FDRRecordPrinterTest.cpp +++ b/llvm/unittests/XRay/FDRRecordPrinterTest.cpp @@ -26,82 +26,76 @@ template <> struct Helper { return make_unique(1); } - static constexpr char Expected[] = ""; + static const char *expected() { return ""; } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(1, 2); } - static constexpr char Expected[] = ""; + static const char *expected() { return ""; } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(1); } - static constexpr char Expected[] = ""; + static const char *expected() { return ""; } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(1); } - static constexpr char Expected[] = ""; + static const char *expected() { return ""; } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(4, 1, "data"); } - static constexpr char Expected[] = - ""; + static const char *expected() { + return ""; + } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(1); } - static constexpr char Expected[] = ""; + static const char *expected() { + return ""; + } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(1); } - static constexpr char Expected[] = ""; + static const char *expected() { return ""; } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(1); } - static constexpr char Expected[] = ""; + static const char *expected() { return ""; } }; -const char Helper::Expected[]; template <> struct Helper { static std::unique_ptr construct() { return make_unique(); } - static constexpr char Expected[] = ""; + static const char *expected() { return ""; } }; -const char Helper::Expected[]; template class PrinterTest : public ::testing::Test { protected: @@ -120,7 +114,7 @@ TYPED_TEST_P(PrinterTest, PrintsRecord) { ASSERT_NE(nullptr, this->R); ASSERT_FALSE(errorToBool(this->R->apply(this->P))); this->OS.flush(); - EXPECT_THAT(this->Data, Eq(Helper::Expected)); + EXPECT_THAT(this->Data, Eq(Helper::expected())); } REGISTER_TYPED_TEST_CASE_P(PrinterTest, PrintsRecord); -- cgit v1.2.3