path.data() may return a non null terminated string

and raw_fd_ostream constructor expects a StringRef.

llvm-svn: 227081
This commit is contained in:
Jean-Daniel Dupas 2015-01-26 09:52:37 +00:00
parent 2081cefdbe
commit 344a958fe2
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ public:
this->makeHeader();
std::error_code ec;
llvm::raw_fd_ostream out(outPath.data(), ec, llvm::sys::fs::F_None);
llvm::raw_fd_ostream out(outPath, ec, llvm::sys::fs::F_None);
if (ec)
return ec;

View File

@ -1266,7 +1266,7 @@ public:
std::error_code writeFile(const lld::File &file, StringRef outPath) override {
// Create stream to path.
std::error_code ec;
llvm::raw_fd_ostream out(outPath.data(), ec, llvm::sys::fs::F_Text);
llvm::raw_fd_ostream out(outPath, ec, llvm::sys::fs::F_Text);
if (ec)
return ec;