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;
}

View File

@ -20,7 +20,6 @@
#include "Support/Signals.h"
#include <fstream>
#include <memory>
using std::cerr;
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
@ -52,19 +51,19 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
if (M.get() == 0) {
cerr << argv[0] << ": ";
std::cerr << argv[0] << ": ";
if (ErrorMessage.size())
cerr << ErrorMessage << "\n";
std::cerr << ErrorMessage << "\n";
else
cerr << "bytecode didn't read correctly.\n";
std::cerr << "bytecode didn't read correctly.\n";
return 1;
}
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! Sending to standard output.\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists! Sending to standard output.\n";
} else {
Out = new std::ofstream(OutputFilename.c_str());
}
@ -87,8 +86,8 @@ 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! Sending to standard output.\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists! Sending to standard output.\n";
} else {
Out = new std::ofstream(OutputFilename.c_str());
@ -100,8 +99,8 @@ int main(int argc, char **argv) {
}
if (!Out->good()) {
cerr << argv[0] << ": error opening " << OutputFilename
<< ": sending to stdout instead!\n";
std::cerr << argv[0] << ": error opening " << OutputFilename
<< ": sending to stdout instead!\n";
Out = &std::cout;
}

View File

@ -20,8 +20,6 @@
#include <sys/types.h> // For FileExists
#include <sys/stat.h>
using std::cerr;
static cl::list<std::string>
InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input bytecode files>"));
@ -59,15 +57,15 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
bool FoundAFile = false;
while (1) {
if (Verbose) cerr << "Loading '" << Filename << "'\n";
if (Verbose) std::cerr << "Loading '" << Filename << "'\n";
if (FileExists(Filename)) FoundAFile = true;
Module *Result = ParseBytecodeFile(Filename, &ErrorMessage);
if (Result) return std::auto_ptr<Module>(Result); // Load successful!
if (Verbose) {
cerr << "Error opening bytecode file: '" << Filename << "'";
if (ErrorMessage.size()) cerr << ": " << ErrorMessage;
cerr << "\n";
std::cerr << "Error opening bytecode file: '" << Filename << "'";
if (ErrorMessage.size()) std::cerr << ": " << ErrorMessage;
std::cerr << "\n";
}
if (NextLibPathIdx == LibPaths.size()) break;
@ -75,10 +73,10 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
}
if (FoundAFile)
cerr << "Bytecode file '" << FN << "' corrupt! "
<< "Use 'link -v ...' for more info.\n";
std::cerr << "Bytecode file '" << FN << "' corrupt! "
<< "Use 'link -v ...' for more info.\n";
else
cerr << "Could not locate bytecode file: '" << FN << "'\n";
std::cerr << "Could not locate bytecode file: '" << FN << "'\n";
return std::auto_ptr<Module>();
}
@ -106,29 +104,29 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M(LoadFile(InputFilenames[i]));
if (M.get() == 0) return 1;
if (Verbose) cerr << "Linking in '" << InputFilenames[i] << "'\n";
if (Verbose) std::cerr << "Linking in '" << InputFilenames[i] << "'\n";
if (LinkModules(Composite.get(), M.get(), &ErrorMessage)) {
cerr << argv[0] << ": error linking in '" << InputFilenames[i] << "': "
<< ErrorMessage << "\n";
std::cerr << argv[0] << ": error linking in '" << InputFilenames[i]
<< "': " << ErrorMessage << "\n";
return 1;
}
}
if (DumpAsm) cerr << "Here's the assembly:\n" << Composite.get();
if (DumpAsm) std::cerr << "Here's the assembly:\n" << Composite.get();
std::ostream *Out = &std::cout; // Default to printing to stdout...
if (OutputFilename != "-") {
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());
if (!Out->good()) {
cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n";
return 1;
}
@ -137,7 +135,7 @@ int main(int argc, char **argv) {
RemoveFileOnSignal(OutputFilename);
}
if (Verbose) cerr << "Writing bytecode...\n";
if (Verbose) std::cerr << "Writing bytecode...\n";
WriteBytecodeToFile(Composite.get(), *Out);
if (Out != &std::cout) delete Out;

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;
}

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;
}

View File

@ -20,7 +20,6 @@
#include "Support/Signals.h"
#include <fstream>
#include <memory>
using std::cerr;
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
@ -52,19 +51,19 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
if (M.get() == 0) {
cerr << argv[0] << ": ";
std::cerr << argv[0] << ": ";
if (ErrorMessage.size())
cerr << ErrorMessage << "\n";
std::cerr << ErrorMessage << "\n";
else
cerr << "bytecode didn't read correctly.\n";
std::cerr << "bytecode didn't read correctly.\n";
return 1;
}
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! Sending to standard output.\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists! Sending to standard output.\n";
} else {
Out = new std::ofstream(OutputFilename.c_str());
}
@ -87,8 +86,8 @@ 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! Sending to standard output.\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists! Sending to standard output.\n";
} else {
Out = new std::ofstream(OutputFilename.c_str());
@ -100,8 +99,8 @@ int main(int argc, char **argv) {
}
if (!Out->good()) {
cerr << argv[0] << ": error opening " << OutputFilename
<< ": sending to stdout instead!\n";
std::cerr << argv[0] << ": error opening " << OutputFilename
<< ": sending to stdout instead!\n";
Out = &std::cout;
}

View File

@ -20,7 +20,6 @@
#include "Support/Signals.h"
#include <fstream>
#include <memory>
using std::cerr;
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
@ -52,19 +51,19 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
if (M.get() == 0) {
cerr << argv[0] << ": ";
std::cerr << argv[0] << ": ";
if (ErrorMessage.size())
cerr << ErrorMessage << "\n";
std::cerr << ErrorMessage << "\n";
else
cerr << "bytecode didn't read correctly.\n";
std::cerr << "bytecode didn't read correctly.\n";
return 1;
}
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! Sending to standard output.\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists! Sending to standard output.\n";
} else {
Out = new std::ofstream(OutputFilename.c_str());
}
@ -87,8 +86,8 @@ 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! Sending to standard output.\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename
<< "': file exists! Sending to standard output.\n";
} else {
Out = new std::ofstream(OutputFilename.c_str());
@ -100,8 +99,8 @@ int main(int argc, char **argv) {
}
if (!Out->good()) {
cerr << argv[0] << ": error opening " << OutputFilename
<< ": sending to stdout instead!\n";
std::cerr << argv[0] << ": error opening " << OutputFilename
<< ": sending to stdout instead!\n";
Out = &std::cout;
}

View File

@ -20,8 +20,6 @@
#include <sys/types.h> // For FileExists
#include <sys/stat.h>
using std::cerr;
static cl::list<std::string>
InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input bytecode files>"));
@ -59,15 +57,15 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
bool FoundAFile = false;
while (1) {
if (Verbose) cerr << "Loading '" << Filename << "'\n";
if (Verbose) std::cerr << "Loading '" << Filename << "'\n";
if (FileExists(Filename)) FoundAFile = true;
Module *Result = ParseBytecodeFile(Filename, &ErrorMessage);
if (Result) return std::auto_ptr<Module>(Result); // Load successful!
if (Verbose) {
cerr << "Error opening bytecode file: '" << Filename << "'";
if (ErrorMessage.size()) cerr << ": " << ErrorMessage;
cerr << "\n";
std::cerr << "Error opening bytecode file: '" << Filename << "'";
if (ErrorMessage.size()) std::cerr << ": " << ErrorMessage;
std::cerr << "\n";
}
if (NextLibPathIdx == LibPaths.size()) break;
@ -75,10 +73,10 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
}
if (FoundAFile)
cerr << "Bytecode file '" << FN << "' corrupt! "
<< "Use 'link -v ...' for more info.\n";
std::cerr << "Bytecode file '" << FN << "' corrupt! "
<< "Use 'link -v ...' for more info.\n";
else
cerr << "Could not locate bytecode file: '" << FN << "'\n";
std::cerr << "Could not locate bytecode file: '" << FN << "'\n";
return std::auto_ptr<Module>();
}
@ -106,29 +104,29 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M(LoadFile(InputFilenames[i]));
if (M.get() == 0) return 1;
if (Verbose) cerr << "Linking in '" << InputFilenames[i] << "'\n";
if (Verbose) std::cerr << "Linking in '" << InputFilenames[i] << "'\n";
if (LinkModules(Composite.get(), M.get(), &ErrorMessage)) {
cerr << argv[0] << ": error linking in '" << InputFilenames[i] << "': "
<< ErrorMessage << "\n";
std::cerr << argv[0] << ": error linking in '" << InputFilenames[i]
<< "': " << ErrorMessage << "\n";
return 1;
}
}
if (DumpAsm) cerr << "Here's the assembly:\n" << Composite.get();
if (DumpAsm) std::cerr << "Here's the assembly:\n" << Composite.get();
std::ostream *Out = &std::cout; // Default to printing to stdout...
if (OutputFilename != "-") {
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());
if (!Out->good()) {
cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n";
std::cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n";
return 1;
}
@ -137,7 +135,7 @@ int main(int argc, char **argv) {
RemoveFileOnSignal(OutputFilename);
}
if (Verbose) cerr << "Writing bytecode...\n";
if (Verbose) std::cerr << "Writing bytecode...\n";
WriteBytecodeToFile(Composite.get(), *Out);
if (Out != &std::cout) delete Out;

View File

@ -20,9 +20,6 @@
#include <memory>
#include <algorithm>
using std::cerr;
using std::string;
// The OptimizationList is automatically populated with registered Passes by the
// PassNameParser.
@ -34,10 +31,10 @@ OptimizationList(cl::desc("Optimizations available:"));
// Other command line options...
//
static cl::opt<string>
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
static cl::opt<string>
static cl::opt<std::string>
OutputFilename("o", cl::desc("Override output filename"),
cl::value_desc("filename"));
@ -78,11 +75,11 @@ int main(int argc, char **argv) {
// Load the input module...
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
if (M.get() == 0) {
cerr << argv[0] << ": ";
std::cerr << argv[0] << ": ";
if (ErrorMessage.size())
cerr << ErrorMessage << "\n";
std::cerr << ErrorMessage << "\n";
else
cerr << "bytecode didn't read correctly.\n";
std::cerr << "bytecode didn't read correctly.\n";
return 1;
}
@ -91,15 +88,15 @@ int main(int argc, char **argv) {
if (OutputFilename != "") {
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());
if (!Out->good()) {
cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
return 1;
}
@ -130,10 +127,11 @@ int main(int argc, char **argv) {
assert(target.get() && "Could not allocate target machine!");
Passes.add(Opt->getTargetCtor()(*target.get()));
} else
cerr << argv[0] << ": cannot create pass: " << Opt->getPassName() << "\n";
std::cerr << argv[0] << ": cannot create pass: " << Opt->getPassName()
<< "\n";
if (PrintEachXForm)
Passes.add(new PrintModulePass(&cerr));
Passes.add(new PrintModulePass(&std::cerr));
}
// Check that the module is well formed on completion of optimization
@ -146,7 +144,7 @@ int main(int argc, char **argv) {
// Now that we have all of the passes ready, run them.
if (Passes.run(*M.get()) && !Quiet)
cerr << "Program modified.\n";
std::cerr << "Program modified.\n";
return 0;
}