unittests: explicit stringify StringRefs for conversion
When clang is built outside of the LLVM tree (against a corresponding version),
there is no definition providing for operator<<(std::ostream &, StringRef) which
is required for the assertion routines in google-test tests. Avoid the
compilation failure by explicitly stringifying the StringRef prior to use.
llvm-svn: 200096
diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp
index ade55aa..66da386 100644
--- a/clang/unittests/AST/DeclPrinterTest.cpp
+++ b/clang/unittests/AST/DeclPrinterTest.cpp
@@ -77,7 +77,8 @@
OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder));
if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, FileName))
- return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
+ return testing::AssertionFailure()
+ << "Parsing error in \"" << Code.str() << "\"";
if (Printer.getNumFoundDecls() == 0)
return testing::AssertionFailure()
@@ -90,8 +91,8 @@
if (Printer.getPrinted() != ExpectedPrinted)
return ::testing::AssertionFailure()
- << "Expected \"" << ExpectedPrinted << "\", "
- "got \"" << Printer.getPrinted() << "\"";
+ << "Expected \"" << ExpectedPrinted.str() << "\", "
+ "got \"" << Printer.getPrinted().str() << "\"";
return ::testing::AssertionSuccess();
}