[lld] r312577 - Use raw_string_ostream::str to get a result string.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 14:17:32 PDT 2017


Author: ruiu
Date: Tue Sep  5 14:17:32 2017
New Revision: 312577

URL: http://llvm.org/viewvc/llvm-project?rev=312577&view=rev
Log:
Use raw_string_ostream::str to get a result string.

Looks like raw_string_ostream is buffered. If we do not call `flush`
nor `str`, it is not guaranteed that a result string has all characters
that were written to it.

It wasn't failing on buildbots, but I could reproduce the issue on my
Windows workstation.

Modified:
    lld/trunk/COFF/DriverUtils.cpp

Modified: lld/trunk/COFF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=312577&r1=312576&r2=312577&view=diff
==============================================================================
--- lld/trunk/COFF/DriverUtils.cpp (original)
+++ lld/trunk/COFF/DriverUtils.cpp Tue Sep  5 14:17:32 2017
@@ -357,7 +357,7 @@ static std::string createDefaultXml() {
        << "  </dependency>\n";
   }
   OS << "</assembly>\n";
-  return Ret;
+  return OS.str();
 }
 
 static Expected<std::unique_ptr<MemoryBuffer>>




More information about the llvm-commits mailing list