[llvm-commits] [llvm] r75791 - in /llvm/trunk/tools: bugpoint/BugDriver.cpp bugpoint/CrashDebugger.cpp bugpoint/ExecutionDriver.cpp bugpoint/ExtractFunction.cpp bugpoint/FindBugs.cpp bugpoint/ListReducer.h bugpoint/Miscompilation.cpp bugpoint/ToolRunner.cpp bugpoint/bugpoint.cpp llc/llc.cpp lli/lli.cpp llvm-ar/llvm-ar.cpp llvm-bcanalyzer/llvm-bcanalyzer.cpp llvm-db/Commands.cpp llvm-db/llvm-db.cpp llvm-ld/Optimize.cpp llvm-nm/llvm-nm.cpp llvm-prof/llvm-prof.cpp llvm-ranlib/llvm-ranlib.cpp opt/AnalysisWrappers.cpp

Dan Gohman gohman at apple.com
Wed Jul 15 09:35:29 PDT 2009


Author: djg
Date: Wed Jul 15 11:35:29 2009
New Revision: 75791

URL: http://llvm.org/viewvc/llvm-project?rev=75791&view=rev
Log:
Use errs() instead of std::cerr.

Modified:
    llvm/trunk/tools/bugpoint/BugDriver.cpp
    llvm/trunk/tools/bugpoint/CrashDebugger.cpp
    llvm/trunk/tools/bugpoint/ExecutionDriver.cpp
    llvm/trunk/tools/bugpoint/ExtractFunction.cpp
    llvm/trunk/tools/bugpoint/FindBugs.cpp
    llvm/trunk/tools/bugpoint/ListReducer.h
    llvm/trunk/tools/bugpoint/Miscompilation.cpp
    llvm/trunk/tools/bugpoint/ToolRunner.cpp
    llvm/trunk/tools/bugpoint/bugpoint.cpp
    llvm/trunk/tools/llc/llc.cpp
    llvm/trunk/tools/lli/lli.cpp
    llvm/trunk/tools/llvm-ar/llvm-ar.cpp
    llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
    llvm/trunk/tools/llvm-db/Commands.cpp
    llvm/trunk/tools/llvm-db/llvm-db.cpp
    llvm/trunk/tools/llvm-ld/Optimize.cpp
    llvm/trunk/tools/llvm-nm/llvm-nm.cpp
    llvm/trunk/tools/llvm-prof/llvm-prof.cpp
    llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp
    llvm/trunk/tools/opt/AnalysisWrappers.cpp

Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/BugDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/BugDriver.cpp Wed Jul 15 11:35:29 2009
@@ -117,13 +117,13 @@
         std::cout << "Linking in input file: '" << Filenames[i] << "'\n";
       std::string ErrorMessage;
       if (Linker::LinkModules(Program, M.get(), &ErrorMessage)) {
-        std::cerr << ToolName << ": error linking in '" << Filenames[i] << "': "
-                  << ErrorMessage << '\n';
+        errs() << ToolName << ": error linking in '" << Filenames[i] << "': "
+               << ErrorMessage << '\n';
         return true;
       }
     }
   } catch (const std::string &Error) {
-    std::cerr << ToolName << ": error reading input '" << Error << "'\n";
+    errs() << ToolName << ": error reading input '" << Error << "'\n";
     return true;
   }
 
@@ -209,7 +209,7 @@
       return debugMiscompilation();
     }
   } catch (ToolExecutionError &TEE) {
-    std::cerr << TEE.what();
+    errs() << TEE.what();
     return debugCodeGeneratorCrash();
   }
 
@@ -218,7 +218,7 @@
   try {
     return debugCodeGenerator();
   } catch (ToolExecutionError &TEE) {
-    std::cerr << TEE.what();
+    errs() << TEE.what();
     return debugCodeGeneratorCrash();
   }
 }

Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Wed Jul 15 11:35:29 2009
@@ -28,6 +28,7 @@
 #include "llvm/Transforms/Utils/Cloning.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/CommandLine.h"
+#include <iostream>
 #include <fstream>
 #include <set>
 using namespace llvm;
@@ -75,8 +76,8 @@
 
     BD.Program = ParseInputFile(PrefixOutput.toString(), BD.getContext());
     if (BD.Program == 0) {
-      std::cerr << BD.getToolName() << ": Error reading bitcode file '"
-                << PrefixOutput << "'!\n";
+      errs() << BD.getToolName() << ": Error reading bitcode file '"
+             << PrefixOutput << "'!\n";
       exit(1);
     }
     PrefixOutput.eraseFromDisk();
@@ -631,10 +632,10 @@
 static bool TestForCodeGenCrash(BugDriver &BD, Module *M) {
   try {
     BD.compileProgram(M);
-    std::cerr << '\n';
+    errs() << '\n';
     return false;
   } catch (ToolExecutionError &) {
-    std::cerr << "<crash>\n";
+    errs() << "<crash>\n";
     return true;  // Tool is still crashing.
   }
 }
@@ -643,7 +644,7 @@
 /// crashes on an input.  It attempts to reduce the input as much as possible
 /// while still causing the code generator to crash.
 bool BugDriver::debugCodeGeneratorCrash() {
-  std::cerr << "*** Debugging code generator crash!\n";
+  errs() << "*** Debugging code generator crash!\n";
 
   return DebugACrash(*this, TestForCodeGenCrash);
 }

Modified: llvm/trunk/tools/bugpoint/ExecutionDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExecutionDriver.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/ExecutionDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/ExecutionDriver.cpp Wed Jul 15 11:35:29 2009
@@ -186,7 +186,7 @@
     break;
   }
   if (!Interpreter)
-    std::cerr << Message;
+    errs() << Message;
   else // Display informational messages on stdout instead of stderr
     std::cout << Message;
 
@@ -278,13 +278,13 @@
   sys::Path BitcodeFile ("bugpoint-test-program.bc");
   std::string ErrMsg;
   if (BitcodeFile.makeUnique(true,&ErrMsg)) {
-    std::cerr << ToolName << ": Error making unique filename: " << ErrMsg 
-              << "\n";
+    errs() << ToolName << ": Error making unique filename: " << ErrMsg 
+           << "\n";
     exit(1);
   }
   if (writeProgramToFile(BitcodeFile.toString(), M)) {
-    std::cerr << ToolName << ": Error emitting bitcode to file '"
-              << BitcodeFile << "'!\n";
+    errs() << ToolName << ": Error emitting bitcode to file '"
+           << BitcodeFile << "'!\n";
     exit(1);
   }
 
@@ -313,15 +313,15 @@
     // Emit the program to a bitcode file...
     sys::Path uniqueFilename("bugpoint-test-program.bc");
     if (uniqueFilename.makeUnique(true, &ErrMsg)) {
-      std::cerr << ToolName << ": Error making unique filename: " 
-                << ErrMsg << "!\n";
+      errs() << ToolName << ": Error making unique filename: "
+             << ErrMsg << "!\n";
       exit(1);
     }
     BitcodeFile = uniqueFilename.toString();
 
     if (writeProgramToFile(BitcodeFile, Program)) {
-      std::cerr << ToolName << ": Error emitting bitcode to file '"
-                << BitcodeFile << "'!\n";
+      errs() << ToolName << ": Error emitting bitcode to file '"
+             << BitcodeFile << "'!\n";
       exit(1);
     }
     CreatedBitcode = true;
@@ -336,8 +336,8 @@
   // Check to see if this is a valid output filename...
   sys::Path uniqueFile(OutputFile);
   if (uniqueFile.makeUnique(true, &ErrMsg)) {
-    std::cerr << ToolName << ": Error making unique filename: "
-              << ErrMsg << "\n";
+    errs() << ToolName << ": Error making unique filename: "
+           << ErrMsg << "\n";
     exit(1);
   }
   OutputFile = uniqueFile.toString();
@@ -352,7 +352,7 @@
                                   Timeout, MemoryLimit);
 
   if (RetVal == -1) {
-    std::cerr << "<timeout>";
+    errs() << "<timeout>";
     static bool FirstTimeout = true;
     if (FirstTimeout) {
       std::cout << "\n"
@@ -420,12 +420,12 @@
     ReferenceOutputFile = executeProgramSafely(Filename);
     std::cout << "\nReference output is: " << ReferenceOutputFile << "\n\n";
   } catch (ToolExecutionError &TEE) {
-    std::cerr << TEE.what();
+    errs() << TEE.what();
     if (Interpreter != SafeInterpreter) {
-      std::cerr << "*** There is a bug running the \"safe\" backend.  Either"
-                << " debug it (for example with the -run-cbe bugpoint option,"
-                << " if CBE is being used as the \"safe\" backend), or fix the"
-                << " error some other way.\n";
+      errs() << "*** There is a bug running the \"safe\" backend.  Either"
+             << " debug it (for example with the -run-cbe bugpoint option,"
+             << " if CBE is being used as the \"safe\" backend), or fix the"
+             << " error some other way.\n";
     }
     return false;
   }
@@ -452,7 +452,7 @@
                                         sys::Path(Output.toString()),
                                         AbsTolerance, RelTolerance, &Error)) {
     if (Diff == 2) {
-      std::cerr << "While diffing output: " << Error << '\n';
+      errs() << "While diffing output: " << Error << '\n';
       exit(1);
     }
     FilesDifferent = true;

Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original)
+++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Wed Jul 15 11:35:29 2009
@@ -127,7 +127,7 @@
 
   Module *New = runPassesOn(M, CleanupPasses);
   if (New == 0) {
-    std::cerr << "Final cleanups failed.  Sorry. :(  Please report a bug!\n";
+    errs() << "Final cleanups failed.  Sorry. :(  Please report a bug!\n";
     return M;
   }
   delete M;
@@ -288,9 +288,9 @@
   std::set<Function *> TestFunctions;
   for (unsigned i = 0, e = F.size(); i != e; ++i) {
     Function *TNOF = cast<Function>(ValueMap[F[i]]);
-    DEBUG(std::cerr << "Removing function ");
-    DEBUG(WriteAsOperand(std::cerr, TNOF, false));
-    DEBUG(std::cerr << "\n");
+    DEBUG(errs() << "Removing function ");
+    DEBUG(WriteAsOperand(errs(), TNOF, false));
+    DEBUG(errs() << "\n");
     TestFunctions.insert(cast<Function>(NewValueMap[TNOF]));
     DeleteFunctionBody(TNOF);       // Function is now external in this module!
   }
@@ -328,7 +328,7 @@
   std::string ErrMsg;
   if (uniqueFilename.createTemporaryFileOnDisk(true, &ErrMsg)) {
     std::cout << "*** Basic Block extraction failed!\n";
-    std::cerr << "Error creating temporary file: " << ErrMsg << "\n";
+    errs() << "Error creating temporary file: " << ErrMsg << "\n";
     M = swapProgramIn(M);
     EmitProgressBitcode("basicblockextractfail", true);
     swapProgramIn(M);
@@ -339,8 +339,8 @@
   std::ofstream BlocksToNotExtractFile(uniqueFilename.c_str());
   if (!BlocksToNotExtractFile) {
     std::cout << "*** Basic Block extraction failed!\n";
-    std::cerr << "Error writing list of blocks to not extract: " << ErrMsg
-              << "\n";
+    errs() << "Error writing list of blocks to not extract: " << ErrMsg
+           << "\n";
     M = swapProgramIn(M);
     EmitProgressBitcode("basicblockextractfail", true);
     swapProgramIn(M);

Modified: llvm/trunk/tools/bugpoint/FindBugs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/FindBugs.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/FindBugs.cpp (original)
+++ llvm/trunk/tools/bugpoint/FindBugs.cpp Wed Jul 15 11:35:29 2009
@@ -97,7 +97,7 @@
         std::cout << "\n*** diff'd output matches!\n";
       }
     } catch (ToolExecutionError &TEE) {
-      std::cerr << TEE.what();
+      errs() << TEE.what();
       debugCodeGeneratorCrash();
       return true;
     }

Modified: llvm/trunk/tools/bugpoint/ListReducer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ListReducer.h?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/ListReducer.h (original)
+++ llvm/trunk/tools/bugpoint/ListReducer.h Wed Jul 15 11:35:29 2009
@@ -15,8 +15,8 @@
 #ifndef BUGPOINT_LIST_REDUCER_H
 #define BUGPOINT_LIST_REDUCER_H
 
+#include "llvm/Support/raw_ostream.h"
 #include <vector>
-#include <iostream>
 #include <cstdlib>
 #include <algorithm>
 
@@ -58,7 +58,7 @@
 
     case KeepSuffix:
       // cannot be reached!
-      std::cerr << "bugpoint ListReducer internal error: selected empty set.\n";
+      errs() << "bugpoint ListReducer internal error: selected empty set.\n";
       abort();
 
     case NoFailure:
@@ -77,7 +77,7 @@
     while (MidTop > 1) { // Binary split reduction loop
       // Halt if the user presses ctrl-c.
       if (BugpointIsInterrupted) {
-        std::cerr << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
+        errs() << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
         return true;
       }
 
@@ -88,7 +88,7 @@
           NumOfIterationsWithoutProgress > MaxIterations) {
         std::vector<ElTy> ShuffledList(TheList);
         std::random_shuffle(ShuffledList.begin(), ShuffledList.end());
-        std::cerr << "\n\n*** Testing shuffled set...\n\n";
+        errs() << "\n\n*** Testing shuffled set...\n\n";
         // Check that random shuffle doesn't loose the bug
         if (doTest(ShuffledList, empty) == KeepPrefix) {
           // If the bug is still here, use the shuffled list.
@@ -97,10 +97,10 @@
           // Must increase the shuffling treshold to avoid the small 
           // probability of inifinite looping without making progress.
           MaxIterations += 2;
-          std::cerr << "\n\n*** Shuffling does not hide the bug...\n\n";
+          errs() << "\n\n*** Shuffling does not hide the bug...\n\n";
         } else {
           ShufflingEnabled = false; // Disable shuffling further on
-          std::cerr << "\n\n*** Shuffling hides the bug...\n\n";
+          errs() << "\n\n*** Shuffling hides the bug...\n\n";
         }
         NumOfIterationsWithoutProgress = 0;
       }
@@ -160,7 +160,7 @@
         
         for (unsigned i = 1; i < TheList.size()-1; ++i) { // Check interior elts
           if (BugpointIsInterrupted) {
-            std::cerr << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
+            errs() << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
             return true;
           }
           

Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Wed Jul 15 11:35:29 2009
@@ -26,6 +26,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Config/config.h"   // for HAVE_LINK_R
+#include <iostream>
 using namespace llvm;
 
 namespace llvm {
@@ -61,8 +62,8 @@
 
   std::string BitcodeResult;
   if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
-    std::cerr << " Error running this sequence of passes"
-              << " on the input program!\n";
+    errs() << " Error running this sequence of passes"
+           << " on the input program!\n";
     BD.setPassesToRun(Suffix);
     BD.EmitProgressBitcode("pass-error",  false);
     exit(BD.debugOptimizerCrash());
@@ -72,8 +73,8 @@
   if (BD.diffProgram(BitcodeResult, "", true /*delete bitcode*/)) {
     std::cout << " nope.\n";
     if (Suffix.empty()) {
-      std::cerr << BD.getToolName() << ": I'm confused: the test fails when "
-                << "no passes are run, nondeterministic program?\n";
+      errs() << BD.getToolName() << ": I'm confused: the test fails when "
+             << "no passes are run, nondeterministic program?\n";
       exit(1);
     }
     return KeepSuffix;         // Miscompilation detected!
@@ -94,8 +95,8 @@
   // prefix passes, then discard the prefix passes.
   //
   if (BD.runPasses(Prefix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
-    std::cerr << " Error running this sequence of passes"
-              << " on the input program!\n";
+    errs() << " Error running this sequence of passes"
+           << " on the input program!\n";
     BD.setPassesToRun(Prefix);
     BD.EmitProgressBitcode("pass-error",  false);
     exit(BD.debugOptimizerCrash());
@@ -114,8 +115,8 @@
   //
   Module *PrefixOutput = ParseInputFile(BitcodeResult, BD.getContext());
   if (PrefixOutput == 0) {
-    std::cerr << BD.getToolName() << ": Error reading bitcode file '"
-              << BitcodeResult << "'!\n";
+    errs() << BD.getToolName() << ": Error reading bitcode file '"
+           << BitcodeResult << "'!\n";
     exit(1);
   }
   sys::Path(BitcodeResult).eraseFromDisk();  // No longer need the file on disk
@@ -130,8 +131,8 @@
 
   Module *OriginalInput = BD.swapProgramIn(PrefixOutput);
   if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
-    std::cerr << " Error running this sequence of passes"
-              << " on the input program!\n";
+    errs() << " Error running this sequence of passes"
+           << " on the input program!\n";
     BD.setPassesToRun(Suffix);
     BD.EmitProgressBitcode("pass-error",  false);
     exit(BD.debugOptimizerCrash());
@@ -187,8 +188,8 @@
     M2 = CloneModule(M2);
   }
   if (Linker::LinkModules(M1, M2, &ErrorMsg)) {
-    std::cerr << BD.getToolName() << ": Error linking modules together:"
-              << ErrorMsg << '\n';
+    errs() << BD.getToolName() << ": Error linking modules together:"
+           << ErrorMsg << '\n';
     exit(1);
   }
   delete M2;   // We are done with this module.
@@ -279,7 +280,7 @@
       return MadeChange;
     }
 
-    std::cerr << "Extracted a loop from the breaking portion of the program.\n";
+    errs() << "Extracted a loop from the breaking portion of the program.\n";
 
     // Bugpoint is intentionally not very trusting of LLVM transformations.  In
     // particular, we're not going to assume that the loop extractor works, so
@@ -291,16 +292,16 @@
       BD.switchToInterpreter(AI);
 
       // Merged program doesn't work anymore!
-      std::cerr << "  *** ERROR: Loop extraction broke the program. :("
-                << " Please report a bug!\n";
-      std::cerr << "      Continuing on with un-loop-extracted version.\n";
+      errs() << "  *** ERROR: Loop extraction broke the program. :("
+             << " Please report a bug!\n";
+      errs() << "      Continuing on with un-loop-extracted version.\n";
 
       BD.writeProgramToFile("bugpoint-loop-extract-fail-tno.bc", ToNotOptimize);
       BD.writeProgramToFile("bugpoint-loop-extract-fail-to.bc", ToOptimize);
       BD.writeProgramToFile("bugpoint-loop-extract-fail-to-le.bc",
                             ToOptimizeLoopExtracted);
 
-      std::cerr << "Please submit the bugpoint-loop-extract-fail-*.bc files.\n";
+      errs() << "Please submit the bugpoint-loop-extract-fail-*.bc files.\n";
       delete ToOptimize;
       delete ToNotOptimize;
       delete ToOptimizeLoopExtracted;
@@ -339,8 +340,8 @@
     // extract another loop.
     std::string ErrorMsg;
     if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted, &ErrorMsg)){
-      std::cerr << BD.getToolName() << ": Error linking modules together:"
-                << ErrorMsg << '\n';
+      errs() << BD.getToolName() << ": Error linking modules together:"
+             << ErrorMsg << '\n';
       exit(1);
     }
     delete ToOptimizeLoopExtracted;
@@ -462,7 +463,7 @@
   Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract);
   if (Extracted == 0) {
     // Weird, extraction should have worked.
-    std::cerr << "Nondeterministic problem extracting blocks??\n";
+    errs() << "Nondeterministic problem extracting blocks??\n";
     delete ProgClone;
     delete ToExtract;
     return false;
@@ -481,8 +482,8 @@
 
   std::string ErrorMsg;
   if (Linker::LinkModules(ProgClone, Extracted, &ErrorMsg)) {
-    std::cerr << BD.getToolName() << ": Error linking modules together:"
-              << ErrorMsg << '\n';
+    errs() << BD.getToolName() << ": Error linking modules together:"
+           << ErrorMsg << '\n';
     exit(1);
   }
   delete Extracted;
@@ -606,8 +607,8 @@
   // Make sure something was miscompiled...
   if (!BugpointIsInterrupted)
     if (!ReduceMiscompilingPasses(*this).reduceList(PassesToRun)) {
-      std::cerr << "*** Optimized program matches reference output!  No problem"
-                << " detected...\nbugpoint can't help you with your problem!\n";
+      errs() << "*** Optimized program matches reference output!  No problem"
+             << " detected...\nbugpoint can't help you with your problem!\n";
       return false;
     }
 
@@ -796,7 +797,7 @@
   }
 
   if (verifyModule(*Test) || verifyModule(*Safe)) {
-    std::cerr << "Bugpoint has a bug, which corrupted a module!!\n";
+    errs() << "Bugpoint has a bug, which corrupted a module!!\n";
     abort();
   }
 }
@@ -813,12 +814,12 @@
   sys::Path TestModuleBC("bugpoint.test.bc");
   std::string ErrMsg;
   if (TestModuleBC.makeUnique(true, &ErrMsg)) {
-    std::cerr << BD.getToolName() << "Error making unique filename: "
-              << ErrMsg << "\n";
+    errs() << BD.getToolName() << "Error making unique filename: "
+           << ErrMsg << "\n";
     exit(1);
   }
   if (BD.writeProgramToFile(TestModuleBC.toString(), Test)) {
-    std::cerr << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
+    errs() << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
     exit(1);
   }
   delete Test;
@@ -826,13 +827,13 @@
   // Make the shared library
   sys::Path SafeModuleBC("bugpoint.safe.bc");
   if (SafeModuleBC.makeUnique(true, &ErrMsg)) {
-    std::cerr << BD.getToolName() << "Error making unique filename: "
-              << ErrMsg << "\n";
+    errs() << BD.getToolName() << "Error making unique filename: "
+           << ErrMsg << "\n";
     exit(1);
   }
 
   if (BD.writeProgramToFile(SafeModuleBC.toString(), Safe)) {
-    std::cerr << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
+    errs() << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
     exit(1);
   }
   std::string SharedObject = BD.compileSharedObject(SafeModuleBC.toString());
@@ -843,9 +844,9 @@
   int Result = BD.diffProgram(TestModuleBC.toString(), SharedObject, false);
 
   if (Result)
-    std::cerr << ": still failing!\n";
+    errs() << ": still failing!\n";
   else
-    std::cerr << ": didn't fail.\n";
+    errs() << ": didn't fail.\n";
   TestModuleBC.eraseFromDisk();
   SafeModuleBC.eraseFromDisk();
   sys::Path(SharedObject).eraseFromDisk();
@@ -885,13 +886,13 @@
   sys::Path TestModuleBC("bugpoint.test.bc");
   std::string ErrMsg;
   if (TestModuleBC.makeUnique(true, &ErrMsg)) {
-    std::cerr << getToolName() << "Error making unique filename: "
-              << ErrMsg << "\n";
+    errs() << getToolName() << "Error making unique filename: "
+           << ErrMsg << "\n";
     exit(1);
   }
 
   if (writeProgramToFile(TestModuleBC.toString(), ToCodeGen)) {
-    std::cerr << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
+    errs() << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
     exit(1);
   }
   delete ToCodeGen;
@@ -899,13 +900,13 @@
   // Make the shared library
   sys::Path SafeModuleBC("bugpoint.safe.bc");
   if (SafeModuleBC.makeUnique(true, &ErrMsg)) {
-    std::cerr << getToolName() << "Error making unique filename: "
-              << ErrMsg << "\n";
+    errs() << getToolName() << "Error making unique filename: "
+           << ErrMsg << "\n";
     exit(1);
   }
 
   if (writeProgramToFile(SafeModuleBC.toString(), ToNotCodeGen)) {
-    std::cerr << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
+    errs() << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
     exit(1);
   }
   std::string SharedObject = compileSharedObject(SafeModuleBC.toString());

Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Wed Jul 15 11:35:29 2009
@@ -63,10 +63,10 @@
   redirects[2] = &StdErrFile;
                                    
   if (0) {
-    std::cerr << "RUN:";
+    errs() << "RUN:";
     for (unsigned i = 0; Args[i]; ++i)
-      std::cerr << " " << Args[i];
-    std::cerr << "\n";
+      errs() << " " << Args[i];
+    errs() << "\n";
   }
 
   return
@@ -87,7 +87,7 @@
   sys::Path ErrorFilename("bugpoint.program_error_messages");
   std::string ErrMsg;
   if (ErrorFilename.makeUnique(true, &ErrMsg)) {
-    std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+    errs() << "Error making unique filename: " << ErrMsg << "\n";
     exit(1);
   }
   RunProgramWithTimeout(ProgPath, Args, sys::Path(""), ErrorFilename,
@@ -159,10 +159,10 @@
   LLIArgs.push_back(0);
 
   std::cout << "<lli>" << std::flush;
-  DEBUG(std::cerr << "\nAbout to run:\t";
+  DEBUG(errs() << "\nAbout to run:\t";
         for (unsigned i=0, e = LLIArgs.size()-1; i != e; ++i)
-          std::cerr << " " << LLIArgs[i];
-        std::cerr << "\n";
+          errs() << " " << LLIArgs[i];
+        errs() << "\n";
         );
   return RunProgramWithTimeout(sys::Path(LLIPath), &LLIArgs[0],
       sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
@@ -295,7 +295,7 @@
   sys::Path uniqueFile(Bitcode+".llc.s");
   std::string ErrMsg;
   if (uniqueFile.makeUnique(true, &ErrMsg)) {
-    std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+    errs() << "Error making unique filename: " << ErrMsg << "\n";
     exit(1);
   }
   OutputAsmFile = uniqueFile;
@@ -313,10 +313,10 @@
   LLCArgs.push_back (0);
 
   std::cout << "<llc>" << std::flush;
-  DEBUG(std::cerr << "\nAbout to run:\t";
+  DEBUG(errs() << "\nAbout to run:\t";
         for (unsigned i=0, e = LLCArgs.size()-1; i != e; ++i)
-          std::cerr << " " << LLCArgs[i];
-        std::cerr << "\n";
+          errs() << " " << LLCArgs[i];
+        errs() << "\n";
         );
   if (RunProgramWithTimeout(sys::Path(LLCPath), &LLCArgs[0],
                             sys::Path(), sys::Path(), sys::Path()))
@@ -369,7 +369,7 @@
   Message = "Found llc: " + LLCPath + "\n";
   GCC *gcc = GCC::create(ProgramPath, Message, GCCArgs);
   if (!gcc) {
-    std::cerr << Message << "\n";
+    errs() << Message << "\n";
     exit(1);
   }
   return new LLC(LLCPath, gcc, Args, GCCArgs);
@@ -430,12 +430,12 @@
   JITArgs.push_back(0);
 
   std::cout << "<jit>" << std::flush;
-  DEBUG(std::cerr << "\nAbout to run:\t";
+  DEBUG(errs() << "\nAbout to run:\t";
         for (unsigned i=0, e = JITArgs.size()-1; i != e; ++i)
-          std::cerr << " " << JITArgs[i];
-        std::cerr << "\n";
+          errs() << " " << JITArgs[i];
+        errs() << "\n";
         );
-  DEBUG(std::cerr << "\nSending output to " << OutputFile << "\n");
+  DEBUG(errs() << "\nSending output to " << OutputFile << "\n");
   return RunProgramWithTimeout(sys::Path(LLIPath), &JITArgs[0],
       sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
       Timeout, MemoryLimit);
@@ -460,7 +460,7 @@
   sys::Path uniqueFile(Bitcode+".cbe.c");
   std::string ErrMsg;
   if (uniqueFile.makeUnique(true, &ErrMsg)) {
-    std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+    errs() << "Error making unique filename: " << ErrMsg << "\n";
     exit(1);
   }
   OutputCFile = uniqueFile;
@@ -479,10 +479,10 @@
   LLCArgs.push_back (0);
 
   std::cout << "<cbe>" << std::flush;
-  DEBUG(std::cerr << "\nAbout to run:\t";
+  DEBUG(errs() << "\nAbout to run:\t";
         for (unsigned i=0, e = LLCArgs.size()-1; i != e; ++i)
-          std::cerr << " " << LLCArgs[i];
-        std::cerr << "\n";
+          errs() << " " << LLCArgs[i];
+        errs() << "\n";
         );
   if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], sys::Path(), sys::Path(),
                             sys::Path()))
@@ -533,7 +533,7 @@
   Message = "Found llc: " + LLCPath.toString() + "\n";
   GCC *gcc = GCC::create(ProgramPath, Message, GCCArgs);
   if (!gcc) {
-    std::cerr << Message << "\n";
+    errs() << Message << "\n";
     exit(1);
   }
   return new CBE(LLCPath, gcc, Args);
@@ -599,7 +599,7 @@
   sys::Path OutputBinary (ProgramFile+".gcc.exe");
   std::string ErrMsg;
   if (OutputBinary.makeUnique(true, &ErrMsg)) {
-    std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+    errs() << "Error making unique filename: " << ErrMsg << "\n";
     exit(1);
   }
   GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
@@ -622,10 +622,10 @@
   GCCArgs.push_back(0);                    // NULL terminator
 
   std::cout << "<gcc>" << std::flush;
-  DEBUG(std::cerr << "\nAbout to run:\t";
+  DEBUG(errs() << "\nAbout to run:\t";
         for (unsigned i=0, e = GCCArgs.size()-1; i != e; ++i)
-          std::cerr << " " << GCCArgs[i];
-        std::cerr << "\n";
+          errs() << " " << GCCArgs[i];
+        errs() << "\n";
         );
   if (RunProgramWithTimeout(GCCPath, &GCCArgs[0], sys::Path(), sys::Path(),
         sys::Path())) {
@@ -666,16 +666,16 @@
 
   // Now that we have a binary, run it!
   std::cout << "<program>" << std::flush;
-  DEBUG(std::cerr << "\nAbout to run:\t";
+  DEBUG(errs() << "\nAbout to run:\t";
         for (unsigned i=0, e = ProgramArgs.size()-1; i != e; ++i)
-          std::cerr << " " << ProgramArgs[i];
-        std::cerr << "\n";
+          errs() << " " << ProgramArgs[i];
+        errs() << "\n";
         );
 
   FileRemover OutputBinaryRemover(OutputBinary);
 
   if (RemoteClientPath.isEmpty()) {
-    DEBUG(std::cerr << "<run locally>" << std::flush;);
+    DEBUG(errs() << "<run locally>";);
     return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
         sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
         Timeout, MemoryLimit);
@@ -685,8 +685,8 @@
         &ProgramArgs[0], sys::Path(InputFile), sys::Path(OutputFile),
         sys::Path(OutputFile), Timeout, MemoryLimit);
     if (RemoteClientStatus != 0) {
-      std::cerr << "Remote Client failed with an error: " <<
-        RemoteClientStatus << ".\n" << std::flush;
+      errs() << "Remote Client failed with an error: " <<
+        RemoteClientStatus << ".\n";
     }
   }
 
@@ -699,7 +699,7 @@
   sys::Path uniqueFilename(InputFile+LTDL_SHLIB_EXT);
   std::string ErrMsg;
   if (uniqueFilename.makeUnique(true, &ErrMsg)) {
-    std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+    errs() << "Error making unique filename: " << ErrMsg << "\n";
     exit(1);
   }
   OutputFile = uniqueFilename.toString();
@@ -757,10 +757,10 @@
   
 
   std::cout << "<gcc>" << std::flush;
-  DEBUG(std::cerr << "\nAbout to run:\t";
+  DEBUG(errs() << "\nAbout to run:\t";
         for (unsigned i=0, e = GCCArgs.size()-1; i != e; ++i)
-          std::cerr << " " << GCCArgs[i];
-        std::cerr << "\n";
+          errs() << " " << GCCArgs[i];
+        errs() << "\n";
         );
   if (RunProgramWithTimeout(GCCPath, &GCCArgs[0], sys::Path(), sys::Path(),
                             sys::Path())) {

Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/bugpoint.cpp (original)
+++ llvm/trunk/tools/bugpoint/bugpoint.cpp Wed Jul 15 11:35:29 2009
@@ -87,20 +87,20 @@
   try {
     return D.run();
   } catch (ToolExecutionError &TEE) {
-    std::cerr << "Tool execution error: " << TEE.what() << '\n';
+    errs() << "Tool execution error: " << TEE.what() << '\n';
   } catch (const std::string& msg) {
-    std::cerr << argv[0] << ": " << msg << "\n";
+    errs() << argv[0] << ": " << msg << "\n";
   } catch (const std::bad_alloc &e) {
-    std::cerr << "Oh no, a bugpoint process ran out of memory!\n"
-                 "To increase the allocation limits for bugpoint child\n"
-                 "processes, use the -mlimit option.\n";
+    errs() << "Oh no, a bugpoint process ran out of memory!\n"
+              "To increase the allocation limits for bugpoint child\n"
+              "processes, use the -mlimit option.\n";
   } catch (const std::exception &e) {
-    std::cerr << "Whoops, a std::exception leaked out of bugpoint: "
-              << e.what() << "\n"
-              << "This is a bug in bugpoint!\n";
+    errs() << "Whoops, a std::exception leaked out of bugpoint: "
+           << e.what() << "\n"
+           << "This is a bug in bugpoint!\n";
   } catch (...) {
-    std::cerr << "Whoops, an exception leaked out of bugpoint.  "
-              << "This is a bug in bugpoint!\n";
+    errs() << "Whoops, an exception leaked out of bugpoint.  "
+           << "This is a bug in bugpoint!\n";
   }
   return 1;
 }

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Wed Jul 15 11:35:29 2009
@@ -137,9 +137,9 @@
     // Specified an output filename?
     if (!Force && std::ifstream(OutputFilename.c_str())) {
       // If force is not specified, make sure not to overwrite a file!
-      std::cerr << ProgName << ": error opening '" << OutputFilename
-                << "': file exists!\n"
-                << "Use -f command line argument to force output\n";
+      errs() << ProgName << ": error opening '" << OutputFilename
+             << "': file exists!\n"
+             << "Use -f command line argument to force output\n";
       return 0;
     }
     // Make sure that the Out file gets unlinked from the disk if we get a
@@ -152,7 +152,7 @@
     formatted_raw_ostream *Out =
       new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
     if (!error.empty()) {
-      std::cerr << error << '\n';
+      errs() << error << '\n';
       delete Out;
       return 0;
     }
@@ -192,9 +192,9 @@
 
   if (!Force && std::ifstream(OutputFilename.c_str())) {
     // If force is not specified, make sure not to overwrite a file!
-    std::cerr << ProgName << ": error opening '" << OutputFilename
-                          << "': file exists!\n"
-                          << "Use -f command line argument to force output\n";
+    errs() << ProgName << ": error opening '" << OutputFilename
+                       << "': file exists!\n"
+                       << "Use -f command line argument to force output\n";
     return 0;
   }
 
@@ -208,7 +208,7 @@
   formatted_raw_ostream *Out =
     new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
   if (!error.empty()) {
-    std::cerr << error << '\n';
+    errs() << error << '\n';
     delete Out;
     return 0;
   }
@@ -237,8 +237,8 @@
   if (Buffer.get())
     M.reset(ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage));
   if (M.get() == 0) {
-    std::cerr << argv[0] << ": bitcode didn't read correctly.\n";
-    std::cerr << "Reason: " << ErrorMessage << "\n";
+    errs() << argv[0] << ": bitcode didn't read correctly.\n";
+    errs() << "Reason: " << ErrorMessage << "\n";
     return 1;
   }
   Module &mod = *M.get();
@@ -256,9 +256,9 @@
     std::string Err;
     TheTarget = TargetRegistry::getClosestStaticTargetForModule(mod, Err);
     if (TheTarget == 0) {
-      std::cerr << argv[0] << ": error auto-selecting target for module '"
-                << Err << "'.  Please use the -march option to explicitly "
-                << "pick a target.\n";
+      errs() << argv[0] << ": error auto-selecting target for module '"
+             << Err << "'.  Please use the -march option to explicitly "
+             << "pick a target.\n";
       return 1;
     }
   }
@@ -285,7 +285,7 @@
   CodeGenOpt::Level OLvl = CodeGenOpt::Default;
   switch (OptLevel) {
   default:
-    std::cerr << argv[0] << ": invalid optimization level.\n";
+    errs() << argv[0] << ": invalid optimization level.\n";
     return 1;
   case ' ': break;
   case '0': OLvl = CodeGenOpt::None; break;
@@ -304,8 +304,8 @@
 
     // Ask the target to add backend passes as necessary.
     if (Target.addPassesToEmitWholeFile(PM, *Out, FileType, OLvl)) {
-      std::cerr << argv[0] << ": target does not support generation of this"
-                << " file type!\n";
+      errs() << argv[0] << ": target does not support generation of this"
+             << " file type!\n";
       if (Out != &fouts()) delete Out;
       // And the Out file is empty and useless, so remove it now.
       sys::Path(OutputFilename).eraseFromDisk();
@@ -334,8 +334,8 @@
       assert(0 && "Invalid file model!");
       return 1;
     case FileModel::Error:
-      std::cerr << argv[0] << ": target does not support generation of this"
-                << " file type!\n";
+      errs() << argv[0] << ": target does not support generation of this"
+             << " file type!\n";
       if (Out != &fouts()) delete Out;
       // And the Out file is empty and useless, so remove it now.
       sys::Path(OutputFilename).eraseFromDisk();
@@ -351,8 +351,8 @@
     }
 
     if (Target.addPassesToEmitFileFinish(Passes, OCE, OLvl)) {
-      std::cerr << argv[0] << ": target does not support generation of this"
-                << " file type!\n";
+      errs() << argv[0] << ": target does not support generation of this"
+             << " file type!\n";
       if (Out != &fouts()) delete Out;
       // And the Out file is empty and useless, so remove it now.
       sys::Path(OutputFilename).eraseFromDisk();

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Wed Jul 15 11:35:29 2009
@@ -112,8 +112,8 @@
   }
   
   if (!MP) {
-    std::cerr << argv[0] << ": error loading program '" << InputFile << "': "
-              << ErrorMsg << "\n";
+    errs() << argv[0] << ": error loading program '" << InputFile << "': "
+           << ErrorMsg << "\n";
     exit(1);
   }
 
@@ -121,8 +121,8 @@
   Module *Mod = NoLazyCompilation
     ? MP->materializeModule(&ErrorMsg) : MP->getModule();
   if (!Mod) {
-    std::cerr << argv[0] << ": bitcode didn't read correctly.\n";
-    std::cerr << "Reason: " << ErrorMsg << "\n";
+    errs() << argv[0] << ": bitcode didn't read correctly.\n";
+    errs() << "Reason: " << ErrorMsg << "\n";
     exit(1);
   }
 
@@ -133,7 +133,7 @@
   CodeGenOpt::Level OLvl = CodeGenOpt::Default;
   switch (OptLevel) {
   default:
-    std::cerr << argv[0] << ": invalid optimization level.\n";
+    errs() << argv[0] << ": invalid optimization level.\n";
     return 1;
   case ' ': break;
   case '0': OLvl = CodeGenOpt::None; break;
@@ -149,9 +149,9 @@
   EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg, OLvl);
   if (!EE) {
     if (!ErrorMsg.empty())
-      std::cerr << argv[0] << ": error creating EE: " << ErrorMsg << "\n";
+      errs() << argv[0] << ": error creating EE: " << ErrorMsg << "\n";
     else
-      std::cerr << argv[0] << ": unknown error creating EE!\n";
+      errs() << argv[0] << ": unknown error creating EE!\n";
     exit(1);
   }
 
@@ -182,7 +182,7 @@
   //
   Function *EntryFn = Mod->getFunction(EntryFunc);
   if (!EntryFn) {
-    std::cerr << '\'' << EntryFunc << "\' function not found in module.\n";
+    errs() << '\'' << EntryFunc << "\' function not found in module.\n";
     return -1;
   }
 
@@ -219,10 +219,10 @@
     ResultGV.IntVal = APInt(32, Result);
     Args.push_back(ResultGV);
     EE->runFunction(ExitF, Args);
-    std::cerr << "ERROR: exit(" << Result << ") returned!\n";
+    errs() << "ERROR: exit(" << Result << ") returned!\n";
     abort();
   } else {
-    std::cerr << "ERROR: exit defined with wrong prototype!\n";
+    errs() << "ERROR: exit defined with wrong prototype!\n";
     abort();
   }
 }

Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Wed Jul 15 11:35:29 2009
@@ -18,6 +18,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Signals.h"
 #include <iostream>
 #include <algorithm>
@@ -718,15 +719,15 @@
     if (!ArchivePath.exists()) {
       // Produce a warning if we should and we're creating the archive
       if (!Create)
-        std::cerr << argv[0] << ": creating " << ArchivePath.toString() << "\n";
+        errs() << argv[0] << ": creating " << ArchivePath.toString() << "\n";
       TheArchive = Archive::CreateEmpty(ArchivePath, Context);
       TheArchive->writeToDisk();
     } else {
       std::string Error;
       TheArchive = Archive::OpenAndLoad(ArchivePath, Context, &Error);
       if (TheArchive == 0) {
-        std::cerr << argv[0] << ": error loading '" << ArchivePath << "': "
-                  << Error << "!\n";
+        errs() << argv[0] << ": error loading '" << ArchivePath << "': "
+               << Error << "!\n";
         return 1;
       }
     }
@@ -749,27 +750,27 @@
       case DisplayTable:    haveError = doDisplayTable(&ErrMsg); break;
       case Extract:         haveError = doExtract(&ErrMsg); break;
       case NoOperation:
-        std::cerr << argv[0] << ": No operation was selected.\n";
+        errs() << argv[0] << ": No operation was selected.\n";
         break;
     }
     if (haveError) {
-      std::cerr << argv[0] << ": " << ErrMsg << "\n";
+      errs() << argv[0] << ": " << ErrMsg << "\n";
       return 1;
     }
   } catch (const char*msg) {
     // These errors are usage errors, thrown only by the various checks in the
     // code above.
-    std::cerr << argv[0] << ": " << msg << "\n\n";
+    errs() << argv[0] << ": " << msg << "\n\n";
     cl::PrintHelpMessage();
     exitCode = 1;
   } catch (const std::string& msg) {
     // These errors are thrown by LLVM libraries (e.g. lib System) and represent
     // a more serious error so we bump the exitCode and don't print the usage.
-    std::cerr << argv[0] << ": " << msg << "\n";
+    errs() << argv[0] << ": " << msg << "\n";
     exitCode = 2;
   } catch (...) {
     // This really shouldn't happen, but just in case ....
-    std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n";
+    errs() << argv[0] << ": An unexpected unknown exception occurred.\n";
     exitCode = 3;
   }
 

Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original)
+++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Wed Jul 15 11:35:29 2009
@@ -289,7 +289,7 @@
 /// Error - All bitcode analysis errors go through this function, making this a
 /// good place to breakpoint if debugging.
 static bool Error(const std::string &Err) {
-  std::cerr << Err << "\n";
+  errs() << Err << "\n";
   return true;
 }
 
@@ -306,7 +306,7 @@
   
   // BLOCKINFO is a special part of the stream.
   if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
-    if (Dump) std::cerr << Indent << "<BLOCKINFO_BLOCK/>\n";
+    if (Dump) errs() << Indent << "<BLOCKINFO_BLOCK/>\n";
     if (Stream.ReadBlockInfoBlock())
       return Error("Malformed BlockInfoBlock");
     uint64_t BlockBitEnd = Stream.GetCurrentBitNo();
@@ -320,17 +320,17 @@
 
   const char *BlockName = 0;
   if (Dump) {
-    std::cerr << Indent << "<";
+    errs() << Indent << "<";
     if ((BlockName = GetBlockName(BlockID, *Stream.getBitStreamReader())))
-      std::cerr << BlockName;
+      errs() << BlockName;
     else
-      std::cerr << "UnknownBlock" << BlockID;
+      errs() << "UnknownBlock" << BlockID;
     
     if (NonSymbolic && BlockName)
-      std::cerr << " BlockID=" << BlockID;
+      errs() << " BlockID=" << BlockID;
     
-    std::cerr << " NumWords=" << NumWords
-              << " BlockCodeSize=" << Stream.GetAbbrevIDWidth() << ">\n";
+    errs() << " NumWords=" << NumWords
+           << " BlockCodeSize=" << Stream.GetAbbrevIDWidth() << ">\n";
   }
   
   SmallVector<uint64_t, 64> Record;
@@ -351,11 +351,11 @@
       uint64_t BlockBitEnd = Stream.GetCurrentBitNo();
       BlockStats.NumBits += BlockBitEnd-BlockBitStart;
       if (Dump) {
-        std::cerr << Indent << "</";
+        errs() << Indent << "</";
         if (BlockName)
-          std::cerr << BlockName << ">\n";
+          errs() << BlockName << ">\n";
         else
-          std::cerr << "UnknownBlock" << BlockID << ">\n";
+          errs() << "UnknownBlock" << BlockID << ">\n";
       }
       return false;
     } 
@@ -397,25 +397,25 @@
         BlockStats.CodeFreq[Code].NumAbbrev++;
         
       if (Dump) {
-        std::cerr << Indent << "  <";
+        errs() << Indent << "  <";
         if (const char *CodeName =
               GetCodeName(Code, BlockID, *Stream.getBitStreamReader()))
-          std::cerr << CodeName;
+          errs() << CodeName;
         else
-          std::cerr << "UnknownCode" << Code;
+          errs() << "UnknownCode" << Code;
         if (NonSymbolic &&
             GetCodeName(Code, BlockID, *Stream.getBitStreamReader()))
-          std::cerr << " codeid=" << Code;
+          errs() << " codeid=" << Code;
         if (AbbrevID != bitc::UNABBREV_RECORD)
-          std::cerr << " abbrevid=" << AbbrevID;
+          errs() << " abbrevid=" << AbbrevID;
 
         for (unsigned i = 0, e = Record.size(); i != e; ++i)
-          std::cerr << " op" << i << "=" << (int64_t)Record[i];
+          errs() << " op" << i << "=" << (int64_t)Record[i];
         
-        std::cerr << "/>";
+        errs() << "/>";
         
         if (BlobStart) {
-          std::cerr << " blob data = ";
+          errs() << " blob data = ";
           bool BlobIsPrintable = true;
           for (unsigned i = 0; i != BlobLen; ++i)
             if (!isprint(BlobStart[i])) {
@@ -424,12 +424,12 @@
             }
           
           if (BlobIsPrintable)
-            std::cerr << "'" << std::string(BlobStart, BlobStart+BlobLen) <<"'";
+            errs() << "'" << std::string(BlobStart, BlobStart+BlobLen) <<"'";
           else
-            std::cerr << "unprintable, " << BlobLen << " bytes.";
+            errs() << "unprintable, " << BlobLen << " bytes.";
         }
         
-        std::cerr << "\n";
+        errs() << "\n";
       }
       
       break;
@@ -499,58 +499,58 @@
     ++NumTopBlocks;
   }
   
-  if (Dump) std::cerr << "\n\n";
+  if (Dump) errs() << "\n\n";
   
   uint64_t BufferSizeBits = (EndBufPtr-BufPtr)*CHAR_BIT;
   // Print a summary of the read file.
-  std::cerr << "Summary of " << InputFilename << ":\n";
-  std::cerr << "         Total size: ";
+  errs() << "Summary of " << InputFilename << ":\n";
+  errs() << "         Total size: ";
   PrintSize(BufferSizeBits);
-  std::cerr << "\n";
-  std::cerr << "        Stream type: ";
+  errs() << "\n";
+  errs() << "        Stream type: ";
   switch (CurStreamType) {
   default: assert(0 && "Unknown bitstream type");
-  case UnknownBitstream: std::cerr << "unknown\n"; break;
-  case LLVMIRBitstream:  std::cerr << "LLVM IR\n"; break;
+  case UnknownBitstream: errs() << "unknown\n"; break;
+  case LLVMIRBitstream:  errs() << "LLVM IR\n"; break;
   }
-  std::cerr << "  # Toplevel Blocks: " << NumTopBlocks << "\n";
-  std::cerr << "\n";
+  errs() << "  # Toplevel Blocks: " << NumTopBlocks << "\n";
+  errs() << "\n";
 
   // Emit per-block stats.
-  std::cerr << "Per-block Summary:\n";
+  errs() << "Per-block Summary:\n";
   for (std::map<unsigned, PerBlockIDStats>::iterator I = BlockIDStats.begin(),
        E = BlockIDStats.end(); I != E; ++I) {
-    std::cerr << "  Block ID #" << I->first;
+    errs() << "  Block ID #" << I->first;
     if (const char *BlockName = GetBlockName(I->first, StreamFile))
-      std::cerr << " (" << BlockName << ")";
-    std::cerr << ":\n";
+      errs() << " (" << BlockName << ")";
+    errs() << ":\n";
     
     const PerBlockIDStats &Stats = I->second;
-    std::cerr << "      Num Instances: " << Stats.NumInstances << "\n";
-    std::cerr << "         Total Size: ";
+    errs() << "      Num Instances: " << Stats.NumInstances << "\n";
+    errs() << "         Total Size: ";
     PrintSize(Stats.NumBits);
-    std::cerr << "\n";
-    std::cerr << "          % of file: "
-              << Stats.NumBits/(double)BufferSizeBits*100 << "\n";
+    errs() << "\n";
+    errs() << "          % of file: "
+           << Stats.NumBits/(double)BufferSizeBits*100 << "\n";
     if (Stats.NumInstances > 1) {
-      std::cerr << "       Average Size: ";
+      errs() << "       Average Size: ";
       PrintSize(Stats.NumBits/(double)Stats.NumInstances);
-      std::cerr << "\n";
-      std::cerr << "  Tot/Avg SubBlocks: " << Stats.NumSubBlocks << "/"
-                << Stats.NumSubBlocks/(double)Stats.NumInstances << "\n";
-      std::cerr << "    Tot/Avg Abbrevs: " << Stats.NumAbbrevs << "/"
-                << Stats.NumAbbrevs/(double)Stats.NumInstances << "\n";
-      std::cerr << "    Tot/Avg Records: " << Stats.NumRecords << "/"
-                << Stats.NumRecords/(double)Stats.NumInstances << "\n";
+      errs() << "\n";
+      errs() << "  Tot/Avg SubBlocks: " << Stats.NumSubBlocks << "/"
+             << Stats.NumSubBlocks/(double)Stats.NumInstances << "\n";
+      errs() << "    Tot/Avg Abbrevs: " << Stats.NumAbbrevs << "/"
+             << Stats.NumAbbrevs/(double)Stats.NumInstances << "\n";
+      errs() << "    Tot/Avg Records: " << Stats.NumRecords << "/"
+             << Stats.NumRecords/(double)Stats.NumInstances << "\n";
     } else {
-      std::cerr << "      Num SubBlocks: " << Stats.NumSubBlocks << "\n";
-      std::cerr << "        Num Abbrevs: " << Stats.NumAbbrevs << "\n";
-      std::cerr << "        Num Records: " << Stats.NumRecords << "\n";
+      errs() << "      Num SubBlocks: " << Stats.NumSubBlocks << "\n";
+      errs() << "        Num Abbrevs: " << Stats.NumAbbrevs << "\n";
+      errs() << "        Num Records: " << Stats.NumRecords << "\n";
     }
     if (Stats.NumRecords)
-      std::cerr << "      % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/
-                   (double)Stats.NumRecords)*100 << "\n";
-    std::cerr << "\n";
+      errs() << "      % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/
+                (double)Stats.NumRecords)*100 << "\n";
+    errs() << "\n";
     
     // Print a histogram of the codes we see.
     if (!NoHistogram && !Stats.CodeFreq.empty()) {
@@ -561,7 +561,7 @@
       std::stable_sort(FreqPairs.begin(), FreqPairs.end());
       std::reverse(FreqPairs.begin(), FreqPairs.end());
       
-      std::cerr << "\tRecord Histogram:\n";
+      errs() << "\tRecord Histogram:\n";
       fprintf(stderr, "\t\t  Count    # Bits   %% Abv  Record Kind\n");
       for (unsigned i = 0, e = FreqPairs.size(); i != e; ++i) {
         const PerRecordStats &RecStats = Stats.CodeFreq[FreqPairs[i].second];
@@ -581,7 +581,7 @@
         else
           fprintf(stderr, "UnknownCode%d\n", FreqPairs[i].second);
       }
-      std::cerr << "\n";
+      errs() << "\n";
       
     }
   }

Modified: llvm/trunk/tools/llvm-db/Commands.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/Commands.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-db/Commands.cpp (original)
+++ llvm/trunk/tools/llvm-db/Commands.cpp Wed Jul 15 11:35:29 2009
@@ -500,7 +500,7 @@
   if (File == 0)
     throw "Unknown file to place breakpoint!";
 
-  std::cerr << "Break: " << File->getFilename() << ":" << LineNo << "\n";
+  errs() << "Break: " << File->getFilename() << ":" << LineNo << "\n";
 
   throw "breakpoints not implemented yet!";
 }

Modified: llvm/trunk/tools/llvm-db/llvm-db.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/llvm-db.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-db/llvm-db.cpp (original)
+++ llvm/trunk/tools/llvm-db/llvm-db.cpp Wed Jul 15 11:35:29 2009
@@ -94,9 +94,9 @@
     // Now that we have initialized the debugger, run it.
     return D.run();
   } catch (const std::string& msg) {
-    std::cerr << argv[0] << ": " << msg << "\n";
+    errs() << argv[0] << ": " << msg << "\n";
   } catch (...) {
-    std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
+    errs() << argv[0] << ": Unexpected unknown exception occurred.\n";
   }
   return 1;
 }

Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-ld/Optimize.cpp (original)
+++ llvm/trunk/tools/llvm-ld/Optimize.cpp Wed Jul 15 11:35:29 2009
@@ -18,6 +18,7 @@
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/StandardPasses.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/System/DynamicLibrary.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
@@ -109,8 +110,8 @@
     if (Opt->getNormalCtor())
       addPass(Passes, Opt->getNormalCtor()());
     else
-      std::cerr << "llvm-ld: cannot create pass: " << Opt->getPassName() 
-                << "\n";
+      errs() << "llvm-ld: cannot create pass: " << Opt->getPassName() 
+             << "\n";
   }
 
   // The user's passes may leave cruft around. Clean up after them them but

Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Wed Jul 15 11:35:29 2009
@@ -24,6 +24,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Signals.h"
 #include <algorithm>
 #include <cctype>
@@ -147,7 +148,7 @@
     if (Result)
       DumpSymbolNamesFromModule(Result);
     else {
-      std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
+      errs() << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
       return;
     }
     
@@ -156,17 +157,17 @@
     Archive* archive = Archive::OpenAndLoad(sys::Path(Filename), Context,
                                             &ErrorMessage);
     if (!archive)
-      std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
+      errs() << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
     std::vector<Module *> Modules;
     if (archive->getAllModules(Modules, &ErrorMessage)) {
-      std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
+      errs() << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
       return;
     }
     MultipleFiles = true;
     std::for_each (Modules.begin(), Modules.end(), DumpSymbolNamesFromModule);
   } else {
-    std::cerr << ToolName << ": " << Filename << ": "
-              << "unrecognizable file type\n";
+    errs() << ToolName << ": " << Filename << ": "
+           << "unrecognizable file type\n";
     return;
   }
 }

Modified: llvm/trunk/tools/llvm-prof/llvm-prof.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-prof/llvm-prof.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-prof/llvm-prof.cpp (original)
+++ llvm/trunk/tools/llvm-prof/llvm-prof.cpp Wed Jul 15 11:35:29 2009
@@ -270,7 +270,7 @@
       delete Buffer;
     }
     if (M == 0) {
-      std::cerr << argv[0] << ": " << BitcodeFile << ": " 
+      errs() << argv[0] << ": " << BitcodeFile << ": "
         << ErrorMessage << "\n";
       return 1;
     }
@@ -289,9 +289,9 @@
 
     return 0;
   } catch (const std::string& msg) {
-    std::cerr << argv[0] << ": " << msg << "\n";
+    errs() << argv[0] << ": " << msg << "\n";
   } catch (...) {
-    std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
+    errs() << argv[0] << ": Unexpected unknown exception occurred.\n";
   }
   
   return 1;

Modified: llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp (original)
+++ llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp Wed Jul 15 11:35:29 2009
@@ -17,6 +17,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Signals.h"
 #include <iostream>
 #include <iomanip>
@@ -87,13 +88,13 @@
       printSymbolTable(TheArchive);
 
   } catch (const char* msg) {
-    std::cerr << argv[0] << ": " << msg << "\n\n";
+    errs() << argv[0] << ": " << msg << "\n\n";
     exitCode = 1;
   } catch (const std::string& msg) {
-    std::cerr << argv[0] << ": " << msg << "\n";
+    errs() << argv[0] << ": " << msg << "\n";
     exitCode = 2;
   } catch (...) {
-    std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n";
+    errs() << argv[0] << ": An unexpected unknown exception occurred.\n";
     exitCode = 3;
   }
   return exitCode;

Modified: llvm/trunk/tools/opt/AnalysisWrappers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/AnalysisWrappers.cpp?rev=75791&r1=75790&r2=75791&view=diff

==============================================================================
--- llvm/trunk/tools/opt/AnalysisWrappers.cpp (original)
+++ llvm/trunk/tools/opt/AnalysisWrappers.cpp Wed Jul 15 11:35:29 2009
@@ -21,6 +21,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Support/CallSite.h"
 #include "llvm/Analysis/CallGraph.h"
+#include "llvm/Support/raw_ostream.h"
 #include <iostream>
 using namespace llvm;
 
@@ -45,10 +46,10 @@
                        E = CS.arg_end(); AI != E; ++AI)
                   if (isa<Constant>(*AI)) {
                     if (!PrintedFn) {
-                      std::cerr << "Function '" << I->getName() << "':\n";
+                      errs() << "Function '" << I->getName() << "':\n";
                       PrintedFn = true;
                     }
-                    std::cerr << *User;
+                    errs() << *User;
                     break;
                   }
               }





More information about the llvm-commits mailing list