summaryrefslogtreecommitdiff
path: root/tools/llvm-dis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-23 19:27:24 +0000
committerChris Lattner <sabre@nondot.org>2001-07-23 19:27:24 +0000
commit1e78f36127fb0e405d2cf893e2ce3381300a667b (patch)
tree4bd65a77a8fc6e5ec8d07e3f84203f879cb8b8a4 /tools/llvm-dis
parentb49ff5c5ee8d0c3a5b58eaf7cbcaf23c4f2960ea (diff)
downloadllvm-1e78f36127fb0e405d2cf893e2ce3381300a667b.tar.gz
llvm-1e78f36127fb0e405d2cf893e2ce3381300a667b.tar.bz2
llvm-1e78f36127fb0e405d2cf893e2ce3381300a667b.tar.xz
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-dis')
-rw-r--r--tools/llvm-dis/dis.cpp34
-rw-r--r--tools/llvm-dis/llvm-dis.cpp34
2 files changed, 34 insertions, 34 deletions
diff --git a/tools/llvm-dis/dis.cpp b/tools/llvm-dis/dis.cpp
index 59594763eb..462ad7f7b9 100644
--- a/tools/llvm-dis/dis.cpp
+++ b/tools/llvm-dis/dis.cpp
@@ -35,8 +35,8 @@ enum OutputMode {
};
cl::String InputFilename ("", "Load <arg> file, print as assembly", 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::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
clEnumVal(Default, "Write basic blocks in bytecode order"),
clEnumVal(dfo , "Write basic blocks in depth first order"),
@@ -49,36 +49,36 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
ostream *Out = &cout; // Default to printing to stdout...
- Module *C = ParseBytecodeFile(InputFilename.getValue());
+ Module *C = ParseBytecodeFile(InputFilename);
if (C == 0) {
cerr << "bytecode didn't read correctly.\n";
return 1;
}
- 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] == 'b' && IFN[Len-1] == 'c') {
// Source ends in .bc
- OutputFilename.setValue(string(IFN.begin(), IFN.end()-3));
+ OutputFilename = string(IFN.begin(), IFN.end()-3);
} else {
- OutputFilename.setValue(IFN); // Append a .ll to it
+ OutputFilename = IFN; // Append a .ll to it
}
- OutputFilename.setValue(OutputFilename.getValue() + ".ll");
- Out = new ofstream(OutputFilename.getValue().c_str(),
- (Force.getValue() ? 0 : ios::noreplace)|ios::out);
+ OutputFilename += ".ll";
+ Out = new ofstream(OutputFilename.c_str(),
+ (Force ? 0 : ios::noreplace)|ios::out);
}
}
if (!Out->good()) {
- cerr << "Error opening " << OutputFilename.getValue()
+ cerr << "Error opening " << OutputFilename
<< ": sending to stdout instead!\n";
Out = &cout;
}
@@ -86,7 +86,7 @@ int main(int argc, char **argv) {
// All that dis does is write the assembly out to a file... which is exactly
// what the writer library is supposed to do...
//
- if (WriteMode.getValue() == Default) {
+ if (WriteMode == Default) {
(*Out) << C; // Print out in list order
} else {
// TODO: This does not print anything other than the basic blocks in the
@@ -97,7 +97,7 @@ int main(int argc, char **argv) {
Method *M = *I;
(*Out) << "-------------- Method: " << M->getName() << " -------------\n";
- switch (WriteMode.getValue()) {
+ switch (WriteMode) {
case dfo: // Depth First ordering
copy(cfg::df_begin(M), cfg::df_end(M),
ostream_iterator<BasicBlock*>(*Out, "\n"));
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 59594763eb..462ad7f7b9 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -35,8 +35,8 @@ enum OutputMode {
};
cl::String InputFilename ("", "Load <arg> file, print as assembly", 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::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
clEnumVal(Default, "Write basic blocks in bytecode order"),
clEnumVal(dfo , "Write basic blocks in depth first order"),
@@ -49,36 +49,36 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
ostream *Out = &cout; // Default to printing to stdout...
- Module *C = ParseBytecodeFile(InputFilename.getValue());
+ Module *C = ParseBytecodeFile(InputFilename);
if (C == 0) {
cerr << "bytecode didn't read correctly.\n";
return 1;
}
- 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] == 'b' && IFN[Len-1] == 'c') {
// Source ends in .bc
- OutputFilename.setValue(string(IFN.begin(), IFN.end()-3));
+ OutputFilename = string(IFN.begin(), IFN.end()-3);
} else {
- OutputFilename.setValue(IFN); // Append a .ll to it
+ OutputFilename = IFN; // Append a .ll to it
}
- OutputFilename.setValue(OutputFilename.getValue() + ".ll");
- Out = new ofstream(OutputFilename.getValue().c_str(),
- (Force.getValue() ? 0 : ios::noreplace)|ios::out);
+ OutputFilename += ".ll";
+ Out = new ofstream(OutputFilename.c_str(),
+ (Force ? 0 : ios::noreplace)|ios::out);
}
}
if (!Out->good()) {
- cerr << "Error opening " << OutputFilename.getValue()
+ cerr << "Error opening " << OutputFilename
<< ": sending to stdout instead!\n";
Out = &cout;
}
@@ -86,7 +86,7 @@ int main(int argc, char **argv) {
// All that dis does is write the assembly out to a file... which is exactly
// what the writer library is supposed to do...
//
- if (WriteMode.getValue() == Default) {
+ if (WriteMode == Default) {
(*Out) << C; // Print out in list order
} else {
// TODO: This does not print anything other than the basic blocks in the
@@ -97,7 +97,7 @@ int main(int argc, char **argv) {
Method *M = *I;
(*Out) << "-------------- Method: " << M->getName() << " -------------\n";
- switch (WriteMode.getValue()) {
+ switch (WriteMode) {
case dfo: // Depth First ordering
copy(cfg::df_begin(M), cfg::df_end(M),
ostream_iterator<BasicBlock*>(*Out, "\n"));