<div dir="ltr">Why was this reverted (handy to have the reason, and the svn revision number, in the commit message)?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 21, 2019 at 6:30 AM Sam McCall via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: sammccall<br>
Date: Wed Aug 21 06:31:44 2019<br>
New Revision: 369525<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=369525&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=369525&view=rev</a><br>
Log:<br>
Revert "[gtest] Fix printing of StringRef and SmallString in assert messages."<br>
<br>
This reverts commit 4becb2ab4e9f52ce98272d1f5930d6942af5172b.<br>
<br>
Modified:<br>
    llvm/trunk/unittests/ADT/SmallStringTest.cpp<br>
    llvm/trunk/unittests/ADT/StringRefTest.cpp<br>
    llvm/trunk/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h<br>
<br>
Modified: llvm/trunk/unittests/ADT/SmallStringTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallStringTest.cpp?rev=369525&r1=369524&r2=369525&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallStringTest.cpp?rev=369525&r1=369524&r2=369525&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/ADT/SmallStringTest.cpp (original)<br>
+++ llvm/trunk/unittests/ADT/SmallStringTest.cpp Wed Aug 21 06:31:44 2019<br>
@@ -169,7 +169,7 @@ TEST_F(SmallStringTest, Realloc) {<br>
   EXPECT_EQ("abcdyyy", theString.slice(0, 7));<br>
 }<br>
<br>
-TEST_F(SmallStringTest, Comparisons) {<br>
+TEST(StringRefTest, Comparisons) {<br>
   EXPECT_EQ(-1, SmallString<10>("aab").compare("aad"));<br>
   EXPECT_EQ( 0, SmallString<10>("aab").compare("aab"));<br>
   EXPECT_EQ( 1, SmallString<10>("aab").compare("aaa"));<br>
@@ -203,12 +203,4 @@ TEST_F(SmallStringTest, Comparisons) {<br>
   EXPECT_EQ( 1, SmallString<10>("V8_q0").compare_numeric("V1_q0"));<br>
 }<br>
<br>
-// Check gtest prints SmallString as a string instead of a container of chars.<br>
-// The code is in utils/unittest/googletest/internal/custom/gtest-printers.h<br>
-TEST_F(SmallStringTest, GTestPrinter) {<br>
-  EXPECT_EQ(R"("foo")", ::testing::PrintToString(SmallString<1>("foo")));<br>
-  const SmallVectorImpl<char> &ErasedSmallString = SmallString<1>("foo");<br>
-  EXPECT_EQ(R"("foo")", ::testing::PrintToString(ErasedSmallString));<br>
 }<br>
-<br>
-} // namespace<br>
<br>
Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=369525&r1=369524&r2=369525&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=369525&r1=369524&r2=369525&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/ADT/StringRefTest.cpp (original)<br>
+++ llvm/trunk/unittests/ADT/StringRefTest.cpp Wed Aug 21 06:31:44 2019<br>
@@ -1055,12 +1055,6 @@ TEST(StringRefTest, StringLiteral) {<br>
   EXPECT_EQ(StringRef("Bar"), Strings[1]);<br>
 }<br>
<br>
-// Check gtest prints StringRef as a string instead of a container of chars.<br>
-// The code is in utils/unittest/googletest/internal/custom/gtest-printers.h<br>
-TEST(StringRefTest, GTestPrinter) {<br>
-  EXPECT_EQ(R"("foo")", ::testing::PrintToString(StringRef("foo")));<br>
-}<br>
-<br>
 static_assert(is_trivially_copyable<StringRef>::value, "trivially copyable");<br>
<br>
 } // end anonymous namespace<br>
<br>
Modified: llvm/trunk/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h?rev=369525&r1=369524&r2=369525&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h?rev=369525&r1=369524&r2=369525&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h (original)<br>
+++ llvm/trunk/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h Wed Aug 21 06:31:44 2019<br>
@@ -39,33 +39,4 @@<br>
 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_<br>
 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_<br>
<br>
-#include "llvm/ADT/SmallString.h"<br>
-#include "llvm/ADT/StringRef.h"<br>
-#include <ostream><br>
-<br>
-namespace llvm {<br>
-<br>
-// Printing of llvm String types.<br>
-// gtest sees these as containers of char (they have nested iterator types),<br>
-// so their operator<< is never considered unless we provide PrintTo().<br>
-// PrintStringTo provides quotes and escaping, at the cost of a copy.<br>
-<br>
-inline void PrintTo(llvm::StringRef S, std::ostream *OS) {<br>
-  *OS << ::testing::PrintToString(S.str());<br>
-}<br>
-// We need both SmallString<N> and SmallVectorImpl<char> overloads:<br>
-//  - the SmallString<N> template is needed as overload resolution will<br>
-//    instantiate generic PrintTo<T> rather than do derived-to-base conversion<br>
-//  - but SmallVectorImpl<char> is sometimes the actual static type, in code<br>
-//    that erases the small size<br>
-template <unsigned N><br>
-inline void PrintTo(const SmallString<N> &S, std::ostream *OS) {<br>
-  *OS << ::testing::PrintToString(std::string(S.data(), S.size()));<br>
-}<br>
-inline void PrintTo(const SmallVectorImpl<char> &S, std::ostream *OS) {<br>
-  *OS << ::testing::PrintToString(std::string(S.data(), S.size()));<br>
-}<br>
-<br>
-} // namespace llvm<br>
-<br>
 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>