diff options
author | Chris Lattner <sabre@nondot.org> | 2001-07-23 19:27:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-07-23 19:27:24 +0000 |
commit | 1e78f36127fb0e405d2cf893e2ce3381300a667b (patch) | |
tree | 4bd65a77a8fc6e5ec8d07e3f84203f879cb8b8a4 /tools/llvm-as | |
parent | b49ff5c5ee8d0c3a5b58eaf7cbcaf23c4f2960ea (diff) | |
download | external_llvm-1e78f36127fb0e405d2cf893e2ce3381300a667b.zip external_llvm-1e78f36127fb0e405d2cf893e2ce3381300a667b.tar.gz external_llvm-1e78f36127fb0e405d2cf893e2ce3381300a667b.tar.bz2 |
CommandLine library cleanup. No longer use getValue/setValue, instead, just treat the commandline
args as the objects they represent and the "right thing" will happen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-as')
-rw-r--r-- | tools/llvm-as/as.cpp | 32 | ||||
-rw-r--r-- | tools/llvm-as/llvm-as.cpp | 32 |
2 files changed, 32 insertions, 32 deletions
diff --git a/tools/llvm-as/as.cpp b/tools/llvm-as/as.cpp index 8cb2747..72b63ec 100644 --- a/tools/llvm-as/as.cpp +++ b/tools/llvm-as/as.cpp @@ -19,8 +19,8 @@ #include "llvm/Support/CommandLine.h" cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-"); -cl::String OutputFilename("o", "Override output filename", 0, ""); -cl::Flag Force ("f", "Overwrite output files", 0, false); +cl::String OutputFilename("o", "Override output filename", cl::NoFlags, ""); +cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false); cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false); int main(int argc, char **argv) { @@ -29,38 +29,38 @@ int main(int argc, char **argv) { ostream *Out = 0; try { // Parse the file now... - Module *C = ParseAssemblyFile(InputFilename.getValue()); + Module *C = ParseAssemblyFile(InputFilename); if (C == 0) { cerr << "assembly didn't read correctly.\n"; return 1; } - if (DumpAsm.getValue()) + if (DumpAsm) cerr << "Here's the assembly:\n" << C; - if (OutputFilename.getValue() != "") { // Specified an output filename? - Out = new ofstream(OutputFilename.getValue().c_str(), - (Force.getValue() ? 0 : ios::noreplace)|ios::out); + if (OutputFilename != "") { // Specified an output filename? + Out = new ofstream(OutputFilename.c_str(), + (Force ? 0 : ios::noreplace)|ios::out); } else { - if (InputFilename.getValue() == "-") { - OutputFilename.setValue("-"); + if (InputFilename == "-") { + OutputFilename = "-"; Out = &cout; } else { - string IFN = InputFilename.getValue(); + string IFN = InputFilename; int Len = IFN.length(); if (IFN[Len-3] == '.' && IFN[Len-2] == 'l' && IFN[Len-1] == 'l') { // Source ends in .ll - OutputFilename.setValue(string(IFN.begin(), IFN.end()-3)); + OutputFilename = string(IFN.begin(), IFN.end()-3); } else { - OutputFilename.setValue(IFN); // Append a .bc to it + OutputFilename = IFN; // Append a .bc to it } - OutputFilename.setValue(OutputFilename.getValue() + ".bc"); - Out = new ofstream(OutputFilename.getValue().c_str(), - (Force.getValue() ? 0 : ios::noreplace)|ios::out); + OutputFilename += ".bc"; + Out = new ofstream(OutputFilename.c_str(), + (Force ? 0 : ios::noreplace)|ios::out); } if (!Out->good()) { - cerr << "Error opening " << OutputFilename.getValue() << "!\n"; + cerr << "Error opening " << OutputFilename << "!\n"; delete C; return 1; } diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 8cb2747..72b63ec 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -19,8 +19,8 @@ #include "llvm/Support/CommandLine.h" cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-"); -cl::String OutputFilename("o", "Override output filename", 0, ""); -cl::Flag Force ("f", "Overwrite output files", 0, false); +cl::String OutputFilename("o", "Override output filename", cl::NoFlags, ""); +cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false); cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false); int main(int argc, char **argv) { @@ -29,38 +29,38 @@ int main(int argc, char **argv) { ostream *Out = 0; try { // Parse the file now... - Module *C = ParseAssemblyFile(InputFilename.getValue()); + Module *C = ParseAssemblyFile(InputFilename); if (C == 0) { cerr << "assembly didn't read correctly.\n"; return 1; } - if (DumpAsm.getValue()) + if (DumpAsm) cerr << "Here's the assembly:\n" << C; - if (OutputFilename.getValue() != "") { // Specified an output filename? - Out = new ofstream(OutputFilename.getValue().c_str(), - (Force.getValue() ? 0 : ios::noreplace)|ios::out); + if (OutputFilename != "") { // Specified an output filename? + Out = new ofstream(OutputFilename.c_str(), + (Force ? 0 : ios::noreplace)|ios::out); } else { - if (InputFilename.getValue() == "-") { - OutputFilename.setValue("-"); + if (InputFilename == "-") { + OutputFilename = "-"; Out = &cout; } else { - string IFN = InputFilename.getValue(); + string IFN = InputFilename; int Len = IFN.length(); if (IFN[Len-3] == '.' && IFN[Len-2] == 'l' && IFN[Len-1] == 'l') { // Source ends in .ll - OutputFilename.setValue(string(IFN.begin(), IFN.end()-3)); + OutputFilename = string(IFN.begin(), IFN.end()-3); } else { - OutputFilename.setValue(IFN); // Append a .bc to it + OutputFilename = IFN; // Append a .bc to it } - OutputFilename.setValue(OutputFilename.getValue() + ".bc"); - Out = new ofstream(OutputFilename.getValue().c_str(), - (Force.getValue() ? 0 : ios::noreplace)|ios::out); + OutputFilename += ".bc"; + Out = new ofstream(OutputFilename.c_str(), + (Force ? 0 : ios::noreplace)|ios::out); } if (!Out->good()) { - cerr << "Error opening " << OutputFilename.getValue() << "!\n"; + cerr << "Error opening " << OutputFilename << "!\n"; delete C; return 1; } |