diff options
author | Bill Wendling <isanbard@gmail.com> | 2006-12-07 01:30:32 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2006-12-07 01:30:32 +0000 |
commit | e81561909d128c6e2d8033cb5465a49b2596b26a (patch) | |
tree | 6f2845604d482bc86d8d12aae500292c561d8cd7 /lib/Support | |
parent | 85c671b90870705ba7e10baf99aa306c843f1325 (diff) | |
download | llvm-e81561909d128c6e2d8033cb5465a49b2596b26a.tar.gz llvm-e81561909d128c6e2d8033cb5465a49b2596b26a.tar.bz2 llvm-e81561909d128c6e2d8033cb5465a49b2596b26a.tar.xz |
Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Allocator.cpp | 4 | ||||
-rw-r--r-- | lib/Support/CommandLine.cpp | 94 | ||||
-rw-r--r-- | lib/Support/ConstantRange.cpp | 2 | ||||
-rw-r--r-- | lib/Support/Debug.cpp | 6 | ||||
-rw-r--r-- | lib/Support/GraphWriter.cpp | 16 | ||||
-rw-r--r-- | lib/Support/PluginLoader.cpp | 4 | ||||
-rw-r--r-- | lib/Support/SlowOperationInformer.cpp | 8 | ||||
-rw-r--r-- | lib/Support/Streams.cpp | 7 | ||||
-rw-r--r-- | lib/Support/SystemUtils.cpp | 8 |
9 files changed, 75 insertions, 74 deletions
diff --git a/lib/Support/Allocator.cpp b/lib/Support/Allocator.cpp index 96f0743f3d..632b5f7a22 100644 --- a/lib/Support/Allocator.cpp +++ b/lib/Support/Allocator.cpp @@ -102,6 +102,6 @@ void BumpPtrAllocator::PrintStats() const { for (; R; R = R->getNext(), ++NumRegions) BytesUsed += R->getNumBytesAllocated(); - llvm_cerr << "\nNumber of memory regions: " << NumRegions << "\n"; - llvm_cerr << "Bytes allocated: " << BytesUsed << "\n"; + cerr << "\nNumber of memory regions: " << NumRegions << "\n"; + cerr << "Bytes allocated: " << BytesUsed << "\n"; } diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 3b75f478af..920811a06c 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -84,8 +84,8 @@ static Option *getOption(const std::string &Str) { static void AddArgument(const char *ArgName, Option *Opt) { if (getOption(ArgName)) { - llvm_cerr << ProgramName << ": CommandLine Error: Argument '" - << ArgName << "' defined more than once!\n"; + cerr << ProgramName << ": CommandLine Error: Argument '" + << ArgName << "' defined more than once!\n"; } else { // Add argument to the argument map! (*Options)[ArgName] = Opt; @@ -129,9 +129,9 @@ static inline bool ProvideOption(Option *Handler, const char *ArgName, case ValueOptional: break; default: - llvm_cerr << ProgramName - << ": Bad ValueMask flag! CommandLine usage error:" - << Handler->getValueExpectedFlag() << "\n"; + cerr << ProgramName + << ": Bad ValueMask flag! CommandLine usage error:" + << Handler->getValueExpectedFlag() << "\n"; abort(); break; } @@ -468,8 +468,8 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, } if (Handler == 0) { - llvm_cerr << ProgramName << ": Unknown command line argument '" - << argv[i] << "'. Try: '" << argv[0] << " --help'\n"; + cerr << ProgramName << ": Unknown command line argument '" + << argv[i] << "'. Try: '" << argv[0] << " --help'\n"; ErrorParsing = true; continue; } @@ -505,18 +505,18 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, // Check and handle positional arguments now... if (NumPositionalRequired > PositionalVals.size()) { - llvm_cerr << ProgramName - << ": Not enough positional command line arguments specified!\n" - << "Must specify at least " << NumPositionalRequired - << " positional arguments: See: " << argv[0] << " --help\n"; + cerr << ProgramName + << ": Not enough positional command line arguments specified!\n" + << "Must specify at least " << NumPositionalRequired + << " positional arguments: See: " << argv[0] << " --help\n"; ErrorParsing = true; } else if (!HasUnlimitedPositionals && PositionalVals.size() > PositionalOpts.size()) { - llvm_cerr << ProgramName - << ": Too many positional arguments specified!\n" - << "Can specify at most " << PositionalOpts.size() - << " positional arguments: See: " << argv[0] << " --help\n"; + cerr << ProgramName + << ": Too many positional arguments specified!\n" + << "Can specify at most " << PositionalOpts.size() + << " positional arguments: See: " << argv[0] << " --help\n"; ErrorParsing = true; } else if (ConsumeAfterOpt == 0) { @@ -617,11 +617,11 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, bool Option::error(std::string Message, const char *ArgName) { if (ArgName == 0) ArgName = ArgStr; if (ArgName[0] == 0) - llvm_cerr << HelpStr; // Be nice for positional arguments + cerr << HelpStr; // Be nice for positional arguments else - llvm_cerr << ProgramName << ": for the -" << ArgName; + cerr << ProgramName << ": for the -" << ArgName; - llvm_cerr << " option: " << Message << "\n"; + cerr << " option: " << Message << "\n"; return true; } @@ -701,8 +701,8 @@ unsigned alias::getOptionWidth() const { // Print out the option for the alias. void alias::printOptionInfo(unsigned GlobalWidth) const { unsigned L = std::strlen(ArgStr); - llvm_cout << " -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - " - << HelpStr << "\n"; + cout << " -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - " + << HelpStr << "\n"; } @@ -728,13 +728,13 @@ unsigned basic_parser_impl::getOptionWidth(const Option &O) const { // void basic_parser_impl::printOptionInfo(const Option &O, unsigned GlobalWidth) const { - llvm_cout << " -" << O.ArgStr; + cout << " -" << O.ArgStr; if (const char *ValName = getValueName()) - llvm_cout << "=<" << getValueStr(O, ValName) << ">"; + cout << "=<" << getValueStr(O, ValName) << ">"; - llvm_cout << std::string(GlobalWidth-getOptionWidth(O), ' ') << " - " - << O.HelpStr << "\n"; + cout << std::string(GlobalWidth-getOptionWidth(O), ' ') << " - " + << O.HelpStr << "\n"; } @@ -850,21 +850,21 @@ void generic_parser_base::printOptionInfo(const Option &O, unsigned GlobalWidth) const { if (O.hasArgStr()) { unsigned L = std::strlen(O.ArgStr); - llvm_cout << " -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ') - << " - " << O.HelpStr << "\n"; + cout << " -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ') + << " - " << O.HelpStr << "\n"; for (unsigned i = 0, e = getNumOptions(); i != e; ++i) { unsigned NumSpaces = GlobalWidth-strlen(getOption(i))-8; - llvm_cout << " =" << getOption(i) << std::string(NumSpaces, ' ') - << " - " << getDescription(i) << "\n"; + cout << " =" << getOption(i) << std::string(NumSpaces, ' ') + << " - " << getDescription(i) << "\n"; } } else { if (O.HelpStr[0]) - llvm_cout << " " << O.HelpStr << "\n"; + cout << " " << O.HelpStr << "\n"; for (unsigned i = 0, e = getNumOptions(); i != e; ++i) { unsigned L = std::strlen(getOption(i)); - llvm_cout << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ') - << " - " << getDescription(i) << "\n"; + cout << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ') + << " - " << getDescription(i) << "\n"; } } } @@ -917,9 +917,9 @@ public: } if (ProgramOverview) - llvm_cout << "OVERVIEW:" << ProgramOverview << "\n"; + cout << "OVERVIEW:" << ProgramOverview << "\n"; - llvm_cout << "USAGE: " << ProgramName << " [options]"; + cout << "USAGE: " << ProgramName << " [options]"; // Print out the positional options. std::vector<Option*> &PosOpts = *PositionalOptions; @@ -929,28 +929,28 @@ public: for (unsigned i = CAOpt != 0, e = PosOpts.size(); i != e; ++i) { if (PosOpts[i]->ArgStr[0]) - llvm_cout << " --" << PosOpts[i]->ArgStr; - llvm_cout << " " << PosOpts[i]->HelpStr; + cout << " --" << PosOpts[i]->ArgStr; + cout << " " << PosOpts[i]->HelpStr; } // Print the consume after option info if it exists... - if (CAOpt) llvm_cout << " " << CAOpt->HelpStr; + if (CAOpt) cout << " " << CAOpt->HelpStr; - llvm_cout << "\n\n"; + cout << "\n\n"; // Compute the maximum argument length... MaxArgLen = 0; for (unsigned i = 0, e = Opts.size(); i != e; ++i) MaxArgLen = std::max(MaxArgLen, Opts[i].second->getOptionWidth()); - llvm_cout << "OPTIONS:\n"; + cout << "OPTIONS:\n"; for (unsigned i = 0, e = Opts.size(); i != e; ++i) Opts[i].second->printOptionInfo(MaxArgLen); // Print any extra help the user has declared. for (std::vector<const char *>::iterator I = MoreHelp->begin(), E = MoreHelp->end(); I != E; ++I) - llvm_cout << *I; + cout << *I; MoreHelp->clear(); // Halt the program since help information was printed @@ -982,21 +982,21 @@ public: void operator=(bool OptionWasSpecified) { if (OptionWasSpecified) { if (OverrideVersionPrinter == 0) { - llvm_cout << "Low Level Virtual Machine (http://llvm.org/):\n"; - llvm_cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION; + cout << "Low Level Virtual Machine (http://llvm.org/):\n"; + cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION; #ifdef LLVM_VERSION_INFO - llvm_cout << LLVM_VERSION_INFO; + cout << LLVM_VERSION_INFO; #endif - llvm_cout << "\n "; + cout << "\n "; #ifndef __OPTIMIZE__ - llvm_cout << "DEBUG build"; + cout << "DEBUG build"; #else - llvm_cout << "Optimized build"; + cout << "Optimized build"; #endif #ifndef NDEBUG - llvm_cout << " with assertions"; + cout << " with assertions"; #endif - llvm_cout << ".\n"; + cout << ".\n"; Options->clear(); // Don't bother making option dtors remove from map. exit(1); } else { diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index 1f1a1b5757..2c215866c6 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -370,5 +370,5 @@ void ConstantRange::print(std::ostream &OS) const { /// dump - Allow printing from a debugger easily... /// void ConstantRange::dump() const { - print(llvm_cerr); + print(cerr); } diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp index 9cea94c547..949e3d932a 100644 --- a/lib/Support/Debug.cpp +++ b/lib/Support/Debug.cpp @@ -68,9 +68,9 @@ bool llvm::isCurrentDebugType(const char *DebugType) { // places the std::c* I/O streams into one .cpp file and relieves the whole // program from having to have hundreds of static c'tor/d'tors for them. // -llvm_ostream llvm::getErrorOutputStream(const char *DebugType) { +OStream llvm::getErrorOutputStream(const char *DebugType) { if (DebugFlag && isCurrentDebugType(DebugType)) - return llvm_cerr; + return cerr; else - return llvm_null; + return NullStream; } diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp index 01da2e13c5..ecf2bfdb91 100644 --- a/lib/Support/GraphWriter.cpp +++ b/lib/Support/GraphWriter.cpp @@ -28,9 +28,9 @@ void llvm::DisplayGraph(const sys::Path &Filename) { args.push_back(Filename.c_str()); args.push_back(0); - llvm_cerr << "Running 'Graphviz' program... " << std::flush; + cerr << "Running 'Graphviz' program... " << std::flush; if (sys::Program::ExecuteAndWait(Graphviz, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: " << ErrMsg << "\n"; + cerr << "Error viewing graph: " << ErrMsg << "\n"; } #elif (HAVE_GV && HAVE_DOT) sys::Path PSFilename = Filename; @@ -48,11 +48,11 @@ void llvm::DisplayGraph(const sys::Path &Filename) { args.push_back(PSFilename.c_str()); args.push_back(0); - llvm_cerr << "Running 'dot' program... " << std::flush; + cerr << "Running 'dot' program... " << std::flush; if (sys::Program::ExecuteAndWait(dot, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: '" << ErrMsg << "\n"; + cerr << "Error viewing graph: '" << ErrMsg << "\n"; } else { - llvm_cerr << " done. \n"; + cerr << " done. \n"; sys::Path gv(LLVM_PATH_GV); args.clear(); @@ -62,7 +62,7 @@ void llvm::DisplayGraph(const sys::Path &Filename) { ErrMsg.clear(); if (sys::Program::ExecuteAndWait(gv, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: " << ErrMsg << "\n"; + cerr << "Error viewing graph: " << ErrMsg << "\n"; } } PSFilename.eraseFromDisk(); @@ -73,9 +73,9 @@ void llvm::DisplayGraph(const sys::Path &Filename) { args.push_back(Filename.c_str()); args.push_back(0); - llvm_cerr << "Running 'dotty' program... " << std::flush; + cerr << "Running 'dotty' program... " << std::flush; if (sys::Program::ExecuteAndWait(dotty, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: " << ErrMsg << "\n"; + cerr << "Error viewing graph: " << ErrMsg << "\n"; } else { #ifdef __MINGW32__ // Dotty spawns another app and doesn't wait until it returns return; diff --git a/lib/Support/PluginLoader.cpp b/lib/Support/PluginLoader.cpp index abd5e7af7a..97b253e4eb 100644 --- a/lib/Support/PluginLoader.cpp +++ b/lib/Support/PluginLoader.cpp @@ -26,8 +26,8 @@ void PluginLoader::operator=(const std::string &Filename) { std::string Error; if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) { - llvm_cerr << "Error opening '" << Filename << "': " << Error - << "\n -load request ignored.\n"; + cerr << "Error opening '" << Filename << "': " << Error + << "\n -load request ignored.\n"; } else { Plugins->push_back(Filename); } diff --git a/lib/Support/SlowOperationInformer.cpp b/lib/Support/SlowOperationInformer.cpp index 806e7a47cb..a7bdf12fd0 100644 --- a/lib/Support/SlowOperationInformer.cpp +++ b/lib/Support/SlowOperationInformer.cpp @@ -28,8 +28,8 @@ SlowOperationInformer::~SlowOperationInformer() { if (LastPrintAmount) { // If we have printed something, make _sure_ we print the 100% amount, and // also print a newline. - llvm_cout << std::string(LastPrintAmount, '\b') << "Progress " - << OperationName << ": 100% \n"; + cout << std::string(LastPrintAmount, '\b') << "Progress " + << OperationName << ": 100% \n"; } } @@ -40,7 +40,7 @@ SlowOperationInformer::~SlowOperationInformer() { bool SlowOperationInformer::progress(unsigned Amount) { int status = sys::AlarmStatus(); if (status == -1) { - llvm_cout << "\n"; + cout << "\n"; LastPrintAmount = 0; return true; } @@ -61,6 +61,6 @@ bool SlowOperationInformer::progress(unsigned Amount) { OS << "% "; LastPrintAmount = OS.str().size(); - llvm_cout << ToPrint+OS.str() << std::flush; + cout << ToPrint+OS.str() << std::flush; return false; } diff --git a/lib/Support/Streams.cpp b/lib/Support/Streams.cpp index 9ca7590e37..02aec1fff8 100644 --- a/lib/Support/Streams.cpp +++ b/lib/Support/Streams.cpp @@ -16,6 +16,7 @@ #include <iostream> using namespace llvm; -llvm_ostream llvm::llvm_null; -llvm_ostream llvm::llvm_cout(std::cout); -llvm_ostream llvm::llvm_cerr(std::cerr); +OStream llvm::NullStream; +OStream llvm::cout(std::cout); +OStream llvm::cerr(std::cerr); +IStream llvm::cin(std::cin); diff --git a/lib/Support/SystemUtils.cpp b/lib/Support/SystemUtils.cpp index d4dbaeecc4..124251165d 100644 --- a/lib/Support/SystemUtils.cpp +++ b/lib/Support/SystemUtils.cpp @@ -23,10 +23,10 @@ bool llvm::CheckBytecodeOutputToConsole(std::ostream* stream_to_check, bool print_warning) { if (stream_to_check == &std::cout && sys::Process::StandardOutIsDisplayed()) { if (print_warning) { - llvm_cerr << "WARNING: You're attempting to print out a bytecode file.\n" - << "This is inadvisable as it may cause display problems. If\n" - << "you REALLY want to taste LLVM bytecode first-hand, you\n" - << "can force output with the `-f' option.\n\n"; + cerr << "WARNING: You're attempting to print out a bytecode file.\n" + << "This is inadvisable as it may cause display problems. If\n" + << "you REALLY want to taste LLVM bytecode first-hand, you\n" + << "can force output with the `-f' option.\n\n"; } return true; } |