diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-25 18:16:47 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-25 18:16:47 +0000 |
| commit | 3fd1e9933f4bb621ab6706b598830ff125fefe50 (patch) | |
| tree | 4db6ed12f77a315b32b45962461944b0fbf2dfe5 /llvm/lib/CodeGen/MachineVerifier.cpp | |
| parent | b709222b8a579a121444485efaa71ea6944eda1d (diff) | |
| download | bcm5719-llvm-3fd1e9933f4bb621ab6706b598830ff125fefe50.tar.gz bcm5719-llvm-3fd1e9933f4bb621ab6706b598830ff125fefe50.zip | |
Modernize raw_fd_ostream's constructor a bit.
Take a StringRef instead of a "const char *".
Take a "std::error_code &" instead of a "std::string &" for error.
A create static method would be even better, but this patch is already a bit too
big.
llvm-svn: 216393
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineVerifier.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp index e08766d292f..a1d83320089 100644 --- a/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/llvm/lib/CodeGen/MachineVerifier.cpp @@ -276,11 +276,12 @@ void MachineFunction::verify(Pass *p, const char *Banner) const { bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) { raw_ostream *OutFile = nullptr; if (OutFileName) { - std::string ErrorInfo; - OutFile = new raw_fd_ostream(OutFileName, ErrorInfo, + std::error_code EC; + OutFile = new raw_fd_ostream(OutFileName, EC, sys::fs::F_Append | sys::fs::F_Text); - if (!ErrorInfo.empty()) { - errs() << "Error opening '" << OutFileName << "': " << ErrorInfo << '\n'; + if (EC) { + errs() << "Error opening '" << OutFileName << "': " << EC.message() + << '\n'; exit(1); } |

