Kill using declarations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2003-05-22 20:13:16 +00:00
parent ca6433f233
commit 6c8103f7dd
9 changed files with 114 additions and 126 deletions

View File

@ -17,13 +17,11 @@
#include "Support/Signals.h"
#include <fstream>
#include <memory>
using std::cerr;
using std::string;
static cl::opt<string>
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
static cl::opt<string>
static cl::opt<std::string>
OutputFilename("o", cl::desc("Override output filename"),
cl::value_desc("filename"));
@ -41,24 +39,25 @@ int main(int argc, char **argv) {
// Parse the file now...
std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
if (M.get() == 0) {
cerr << argv[0] << ": assembly didn't read correctly.\n";
std::cerr << argv[0] << ": assembly didn't read correctly.\n";
return 1;
}
if (verifyModule(*M.get())) {
cerr << argv[0] << ": assembly parsed, but does not verify as correct!\n";
std::cerr << argv[0]
<< ": assembly parsed, but does not verify as correct!\n";
return 1;
}
if (DumpAsm) cerr << "Here's the assembly:\n" << M.get();
if (DumpAsm) std::cerr << "Here's the assembly:\n" << M.get();
if (OutputFilename != "") { // Specified an output filename?
if (!Force && std::ifstream(OutputFilename.c_str())) {
// If force is not specified, make sure not to overwrite a file!
cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists!\n"
<< "Use -f command line argument to force output\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists!\n"
<< "Use -f command line argument to force output\n";
return 1;
}
Out = new std::ofstream(OutputFilename.c_str());
@ -79,9 +78,9 @@ int main(int argc, char **argv) {
if (!Force && std::ifstream(OutputFilename.c_str())) {
// If force is not specified, make sure not to overwrite a file!
cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists!\n"
<< "Use -f command line argument to force output\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists!\n"
<< "Use -f command line argument to force output\n";
return 1;
}
@ -93,13 +92,13 @@ int main(int argc, char **argv) {
}
if (!Out->good()) {
cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
return 1;
}
WriteBytecodeToFile(M.get(), *Out);
} catch (const ParseException &E) {
cerr << argv[0] << ": " << E.getMessage() << "\n";
std::cerr << argv[0] << ": " << E.getMessage() << "\n";
return 1;
}