summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Main.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-08-25 18:16:47 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-08-25 18:16:47 +0000
commit3fd1e9933f4bb621ab6706b598830ff125fefe50 (patch)
tree4db6ed12f77a315b32b45962461944b0fbf2dfe5 /llvm/lib/TableGen/Main.cpp
parentb709222b8a579a121444485efaa71ea6944eda1d (diff)
downloadbcm5719-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/TableGen/Main.cpp')
-rw-r--r--llvm/lib/TableGen/Main.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/TableGen/Main.cpp b/llvm/lib/TableGen/Main.cpp
index d9c5601a5da..2578cc20357 100644
--- a/llvm/lib/TableGen/Main.cpp
+++ b/llvm/lib/TableGen/Main.cpp
@@ -56,11 +56,11 @@ static int createDependencyFile(const TGParser &Parser, const char *argv0) {
errs() << argv0 << ": the option -d must be used together with -o\n";
return 1;
}
- std::string Error;
- tool_output_file DepOut(DependFilename.c_str(), Error, sys::fs::F_Text);
- if (!Error.empty()) {
- errs() << argv0 << ": error opening " << DependFilename
- << ":" << Error << "\n";
+ std::error_code EC;
+ tool_output_file DepOut(DependFilename, EC, sys::fs::F_Text);
+ if (EC) {
+ errs() << argv0 << ": error opening " << DependFilename << ":"
+ << EC.message() << "\n";
return 1;
}
DepOut.os() << OutputFilename << ":";
@@ -101,11 +101,11 @@ int TableGenMain(char *argv0, TableGenMainFn *MainFn) {
if (Parser.ParseFile())
return 1;
- std::string Error;
- tool_output_file Out(OutputFilename.c_str(), Error, sys::fs::F_Text);
- if (!Error.empty()) {
- errs() << argv0 << ": error opening " << OutputFilename
- << ":" << Error << "\n";
+ std::error_code EC;
+ tool_output_file Out(OutputFilename, EC, sys::fs::F_Text);
+ if (EC) {
+ errs() << argv0 << ": error opening " << OutputFilename << ":"
+ << EC.message() << "\n";
return 1;
}
if (!DependFilename.empty()) {
OpenPOWER on IntegriCloud