diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp --- a/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp @@ -183,11 +183,9 @@ std::string DeclFile = MainDie.getDeclFile( DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath); -#if defined(_WIN32) - EXPECT_EQ(DeclFile, "/tmp\\main.cpp"); -#else - EXPECT_EQ(DeclFile, "/tmp/main.cpp"); -#endif + std::string Ref = + ("/tmp" + llvm::sys::path::get_separator() + "main.cpp").str(); + EXPECT_EQ(DeclFile, Ref); } TEST(DWARFDie, getDeclFileAbstractOrigin) { @@ -291,11 +289,9 @@ std::string DeclFile = MainDie.getDeclFile( DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath); -#if defined(_WIN32) - EXPECT_EQ(DeclFile, "/tmp\\main.cpp"); -#else - EXPECT_EQ(DeclFile, "/tmp/main.cpp"); -#endif + std::string Ref = + ("/tmp" + llvm::sys::path::get_separator() + "main.cpp").str(); + EXPECT_EQ(DeclFile, Ref); } TEST(DWARFDie, getDeclFileSpecification) { @@ -398,11 +394,9 @@ std::string DeclFile = MainDie.getDeclFile( DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath); -#if defined(_WIN32) - EXPECT_EQ(DeclFile, "/tmp\\main.cpp"); -#else - EXPECT_EQ(DeclFile, "/tmp/main.cpp"); -#endif + std::string Ref = + ("/tmp" + llvm::sys::path::get_separator() + "main.cpp").str(); + EXPECT_EQ(DeclFile, Ref); } TEST(DWARFDie, getDeclFileAbstractOriginAcrossCUBoundary) { @@ -522,11 +516,9 @@ std::string DeclFile = MainDie.getDeclFile( DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath); -#if defined(_WIN32) - EXPECT_EQ(DeclFile, "/tmp\\main.cpp"); -#else - EXPECT_EQ(DeclFile, "/tmp/main.cpp"); -#endif + std::string Ref = + ("/tmp" + llvm::sys::path::get_separator() + "main.cpp").str(); + EXPECT_EQ(DeclFile, Ref); } TEST(DWARFDie, getDeclFileSpecificationAcrossCUBoundary) { @@ -646,11 +638,9 @@ std::string DeclFile = MainDie.getDeclFile( DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath); -#if defined(_WIN32) - EXPECT_EQ(DeclFile, "/tmp\\main.cpp"); -#else - EXPECT_EQ(DeclFile, "/tmp/main.cpp"); -#endif + std::string Ref = + ("/tmp" + llvm::sys::path::get_separator() + "main.cpp").str(); + EXPECT_EQ(DeclFile, Ref); } } // end anonymous namespace