Removed more <iostream> includes
authorBill Wendling <isanbard@gmail.com>
Thu, 7 Dec 2006 20:28:15 +0000 (20:28 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 7 Dec 2006 20:28:15 +0000 (20:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32321 91177308-0d34-0410-b5e6-96231b3b80d8

18 files changed:
include/llvm/CodeGen/DwarfWriter.h
lib/Analysis/AliasAnalysisCounter.cpp
lib/Analysis/AliasAnalysisEvaluator.cpp
lib/Analysis/DataStructure/DataStructure.cpp
lib/Bytecode/Reader/ReaderWrappers.cpp
lib/CodeGen/LLVMTargetMachine.cpp
lib/CodeGen/LiveVariables.cpp
lib/CodeGen/MachOWriter.cpp
lib/CodeGen/MachineBasicBlock.cpp
lib/CodeGen/MachineFunction.cpp
lib/CodeGen/RegAllocSimple.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/TwoAddressInstructionPass.cpp
lib/Debugger/ProgramInfo.cpp
lib/Debugger/SourceLanguage-Unknown.cpp
lib/Support/Statistic.cpp
lib/Support/SystemUtils.cpp
lib/Support/Timer.cpp

index cbda7438f1cc62d48b95876b25b3b5e66d3ebf55..22417875a5db222fe1e7e10bbd3ad5fead8be906 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef LLVM_CODEGEN_DWARFWRITER_H
 #define LLVM_CODEGEN_DWARFWRITER_H
 
-#include <iostream>
+#include <iosfwd>
 
 namespace llvm {
 
index b2b6739ae105eb5036347baede7dab3d445b2612..d3f0dd0be0f1c7c15b8edca807316885b44d9c12 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Streams.h"
-#include <iostream>
 using namespace llvm;
 
 namespace {
@@ -131,9 +130,9 @@ AliasAnalysisCounter::alias(const Value *V1, unsigned V1Size,
   if (PrintAll || (PrintAllFailures && R == MayAlias)) {
     cerr << AliasString << ":\t";
     cerr << "[" << V1Size << "B] ";
-    WriteAsOperand(std::cerr, V1, true, M) << ", ";
+    WriteAsOperand(*cerr.stream(), V1, true, M) << ", ";
     cerr << "[" << V2Size << "B] ";
-    WriteAsOperand(std::cerr, V2, true, M) << "\n";
+    WriteAsOperand(*cerr.stream(), V2, true, M) << "\n";
   }
 
   return R;
@@ -155,7 +154,7 @@ AliasAnalysisCounter::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
   if (PrintAll || (PrintAllFailures && R == ModRef)) {
     cerr << MRString << ":  Ptr: ";
     cerr << "[" << Size << "B] ";
-    WriteAsOperand(std::cerr, P, true, M);
+    WriteAsOperand(*cerr.stream(), P, true, M);
     cerr << "\t<->" << *CS.getInstruction();
   }
   return R;
index 31875f87104a463466d0f4ee0946944ca85f3706..0f27974c5b37f2150e1701661571eb5c6d68f9c8 100644 (file)
@@ -29,7 +29,6 @@
 #include "llvm/Support/InstIterator.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Streams.h"
-#include <iostream>
 #include <set>
 using namespace llvm;
 
@@ -80,8 +79,8 @@ static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2,
                                 Module *M) {
   if (P) {
     cerr << "  " << Msg << ":\t";
-    WriteAsOperand(std::cerr, V1, true, M) << ", ";
-    WriteAsOperand(std::cerr, V2, true, M) << "\n";
+    WriteAsOperand(*cerr.stream(), V1, true, M) << ", ";
+    WriteAsOperand(*cerr.stream(), V2, true, M) << "\n";
   }
 }
 
@@ -90,7 +89,7 @@ PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr,
                    Module *M) {
   if (P) {
     cerr << "  " << Msg << ":  Ptr: ";
-    WriteAsOperand(std::cerr, Ptr, true, M);
+    WriteAsOperand(*cerr.stream(), Ptr, true, M);
     cerr << "\t<->" << *I;
   }
 }
index c81fd6ad34118e9dba2bc8fb7dbeba8f269e14c4..666b615825b3dded90512db57515eb8838691630 100644 (file)
@@ -26,7 +26,6 @@
 #include "llvm/ADT/SCCIterator.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Timer.h"
-#include <iostream>
 #include <algorithm>
 using namespace llvm;
 
@@ -721,10 +720,10 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
     M = getParentGraph()->retnodes_begin()->first->getParent();
 
   DOUT << "MergeTypeInfo Folding OrigTy: ";
-  DEBUG(WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:";
-        WriteTypeSymbolic(std::cerr, NewTy, M) << " @ " << Offset << "!\n"
-                                               << "SubType: ";
-        WriteTypeSymbolic(std::cerr, SubType, M) << "\n\n");
+  DEBUG(WriteTypeSymbolic(*cerr.stream(), Ty, M) << "\n due to:";
+        WriteTypeSymbolic(*cerr.stream(), NewTy, M) << " @ " << Offset << "!\n"
+                                                    << "SubType: ";
+        WriteTypeSymbolic(*cerr.stream(), SubType, M) << "\n\n");
 
   if (FoldIfIncompatible) foldNodeCompletely();
   return true;
index c12067266992ad6d664fb898c033d4fd4205c8b3..d45a0f79bf38ada8e26030ab91a5881267121490 100644 (file)
@@ -21,9 +21,7 @@
 #include "llvm/System/MappedFile.h"
 #include "llvm/System/Program.h"
 #include <cerrno>
-#include <iostream>
 #include <memory>
-
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -164,9 +162,9 @@ BytecodeStdinReader::read(std::string* ErrMsg)
   char Buffer[4096*4];
 
   // Read in all of the data from stdin, we cannot mmap stdin...
-  while (std::cin.good()) {
-    std::cin.read(Buffer, 4096*4);
-    int BlockSize = std::cin.gcount();
+  while (cin.stream()->good()) {
+    cin.stream()->read(Buffer, 4096*4);
+    int BlockSize = cin.stream()->gcount();
     if (0 >= BlockSize)
       break;
     FileData.insert(FileData.end(), Buffer, Buffer+BlockSize);
index f113b16f2640319a7cb6c717ad76e1916db39595..0098a42dc91442426bdce502db7043dfba0d1e03 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Transforms/Scalar.h"
-#include <iostream>
 using namespace llvm;
 
 bool LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
@@ -46,18 +45,18 @@ bool LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
   
   // Print the instruction selected machine code...
   if (PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   // Perform register allocation to convert to a concrete x86 representation
   PM.add(createRegisterAllocator());
   
   if (PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   
   // Run post-ra passes.
   if (addPostRegAlloc(PM, Fast) && PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   
   // Insert prolog/epilog code.  Eliminate abstract frame index references...
@@ -71,11 +70,11 @@ bool LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
   PM.add(createDebugLabelFoldingPass());
   
   if (PrintMachineCode)  // Print the register-allocated code
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   
   if (addPreEmitPass(PM, Fast) && PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   
   switch (FileType) {
@@ -127,32 +126,32 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
   
   // Print the instruction selected machine code...
   if (PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   // Perform register allocation to convert to a concrete x86 representation
   PM.add(createRegisterAllocator());
   
   if (PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   
   // Run post-ra passes.
   if (addPostRegAlloc(PM, Fast) && PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   
   // Insert prolog/epilog code.  Eliminate abstract frame index references...
   PM.add(createPrologEpilogCodeInserter());
   
   if (PrintMachineCode)  // Print the register-allocated code
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   // Branch folding must be run after regalloc and prolog/epilog insertion.
   if (!Fast)
     PM.add(createBranchFoldingPass());
   
   if (addPreEmitPass(PM, Fast) && PrintMachineCode)
-    PM.add(createMachineFunctionPrinterPass(&std::cerr));
+    PM.add(createMachineFunctionPrinterPass(cerr.stream()));
   
   
   addCodeEmitter(PM, Fast, MCE);
index f5c81da46ff195ef04e9c0dc6f466db8d2f2ac33..e0713c87c990b6ad26d8c427a158ac305d2b3d3d 100644 (file)
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Config/alloca.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 static RegisterPass<LiveVariables> X("livevars", "Live Variable Analysis");
 
 void LiveVariables::VarInfo::dump() const {
-  std::cerr << "Register Defined by: ";
+  cerr << "Register Defined by: ";
   if (DefInst) 
-    std::cerr << *DefInst;
+    cerr << *DefInst;
   else
-    std::cerr << "<null>\n";
-  std::cerr << "  Alive in blocks: ";
+    cerr << "<null>\n";
+  cerr << "  Alive in blocks: ";
   for (unsigned i = 0, e = AliveBlocks.size(); i != e; ++i)
-    if (AliveBlocks[i]) std::cerr << i << ", ";
-  std::cerr << "\n  Killed by:";
+    if (AliveBlocks[i]) cerr << i << ", ";
+  cerr << "\n  Killed by:";
   if (Kills.empty())
-    std::cerr << " No instructions.\n";
+    cerr << " No instructions.\n";
   else {
     for (unsigned i = 0, e = Kills.size(); i != e; ++i)
-      std::cerr << "\n    #" << i << ": " << *Kills[i];
-    std::cerr << "\n";
+      cerr << "\n    #" << i << ": " << *Kills[i];
+    cerr << "\n";
   }
 }
 
index 7c0855a5e13afe3f6db2988484731e952e5c9962..390676973f1506a4c04d8e3ea7230521aec1cc72 100644 (file)
@@ -32,7 +32,6 @@
 #include "llvm/Support/Mangler.h"
 #include "llvm/Support/MathExtras.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
index 8d8e9b7c59c98676b5ebfff60f7006408eadb022..a626f4fdd15ca8a5694091c21f13e698bfb8a653 100644 (file)
@@ -19,7 +19,6 @@
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/LeakDetector.h"
-#include <iostream>
 #include <algorithm>
 using namespace llvm;
 
@@ -87,7 +86,7 @@ MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminator() {
 }
 
 void MachineBasicBlock::dump() const {
-  print(std::cerr);
+  print(*cerr.stream());
 }
 
 void MachineBasicBlock::print(std::ostream &OS) const {
index 5d82f722ef570587316b2c9eaa7d72d973cd0e02..5aaae6deb510b36af5830befa17ad1a696cb563f 100644 (file)
@@ -31,9 +31,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Config/config.h"
 #include <fstream>
-#include <iostream>
 #include <sstream>
-
 using namespace llvm;
 
 static AnnotationID MF_AID(
@@ -177,7 +175,7 @@ void MachineFunction::RenumberBlocks(MachineBasicBlock *MBB) {
 }
 
 
-void MachineFunction::dump() const { print(std::cerr); }
+void MachineFunction::dump() const { print(*cerr.stream()); }
 
 void MachineFunction::print(std::ostream &OS) const {
   OS << "# Machine code for " << Fn->getName () << "():\n";
@@ -268,8 +266,8 @@ void MachineFunction::viewCFG() const
 #ifndef NDEBUG
   ViewGraph(this, "mf" + getFunction()->getName());
 #else
-  std::cerr << "SelectionDAG::viewGraph is only available in debug builds on "
-            << "systems with Graphviz or gv!\n";
+  cerr << "SelectionDAG::viewGraph is only available in debug builds on "
+       << "systems with Graphviz or gv!\n";
 #endif // NDEBUG
 }
 
@@ -350,7 +348,7 @@ void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) const{
 }
 
 void MachineFrameInfo::dump(const MachineFunction &MF) const {
-  print(MF, std::cerr);
+  print(MF, *cerr.stream());
 }
 
 
@@ -390,7 +388,7 @@ unsigned MachineJumpTableInfo::getAlignment() const {
   return TD->getPointerAlignment(); 
 }
 
-void MachineJumpTableInfo::dump() const { print(std::cerr); }
+void MachineJumpTableInfo::dump() const { print(*cerr.stream()); }
 
 
 //===----------------------------------------------------------------------===//
@@ -473,4 +471,4 @@ void MachineConstantPool::print(std::ostream &OS) const {
   }
 }
 
-void MachineConstantPool::dump() const { print(std::cerr); }
+void MachineConstantPool::dump() const { print(*cerr.stream()); }
index 262f8c240e136d9d71510b575bc41a27c24f4146..87ef0031c586a85c24ddfbb4e63cc5cd9754b924 100644 (file)
@@ -27,7 +27,6 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
-#include <iostream>
 using namespace llvm;
 
 namespace {
@@ -192,7 +191,7 @@ void RegAllocSimple::AllocateBasicBlock(MachineBasicBlock &MBB) {
         unsigned virtualReg = (unsigned) op.getReg();
         DOUT << "op: " << op << "\n";
         DOUT << "\t inst[" << i << "]: ";
-        DEBUG(MI->print(std::cerr, TM));
+        DEBUG(MI->print(*cerr.stream(), TM));
 
         // make sure the same virtual register maps to the same physical
         // register in any given instruction
index c279982c00627c10e44e4f92bc3c0586ddd7c518..5f92df3f2d54d59baf6b64ab073292a035290961 100644 (file)
@@ -26,7 +26,6 @@
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
-#include <iostream>
 #include <set>
 #include <algorithm>
 #include <cmath>
@@ -2887,7 +2886,7 @@ void SDNode::dump(const SelectionDAG *G) const {
              dyn_cast<GlobalAddressSDNode>(this)) {
     int offset = GADN->getOffset();
     cerr << "<";
-    WriteAsOperand(std::cerr, GADN->getGlobal()) << ">";
+    WriteAsOperand(*cerr.stream(), GADN->getGlobal()) << ">";
     if (offset > 0)
       cerr << " + " << offset;
     else
index 932542dd21d7bcd28c24669e7b005d82a860f45e..be19e46168e51d0e9fe0192c121f7993b38a3fd5 100644 (file)
@@ -41,7 +41,6 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
-#include <iostream>
 using namespace llvm;
 
 namespace {
@@ -102,7 +101,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
 
         if (FirstTied) {
           ++NumTwoAddressInstrs;
-          DOUT << '\t'; DEBUG(mi->print(std::cerr, &TM));
+          DOUT << '\t'; DEBUG(mi->print(*cerr.stream(), &TM));
         }
         FirstTied = false;
 
@@ -195,7 +194,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
           MRI.copyRegToReg(*mbbi, mi, regA, regB, rc);
 
           MachineBasicBlock::iterator prevMi = prior(mi);
-          DOUT << "\t\tprepend:\t"; DEBUG(prevMi->print(std::cerr, &TM));
+          DOUT << "\t\tprepend:\t"; DEBUG(prevMi->print(*cerr.stream(), &TM));
 
           // Update live variables for regA
           LiveVariables::VarInfo& varInfo = LV.getVarInfo(regA);
@@ -220,7 +219,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
         mi->getOperand(ti).setReg(mi->getOperand(si).getReg());
         MadeChange = true;
 
-        DOUT << "\t\trewrite to:\t"; DEBUG(mi->print(std::cerr, &TM));
+        DOUT << "\t\trewrite to:\t"; DEBUG(mi->print(*cerr.stream(), &TM));
       }
     }
   }
index 05ad4f7a8ba0d3b1cb34d4a8598445c057247bab..a315a2d5ba2c48f60e0fd9b16b1287d3285f62e0 100644 (file)
@@ -23,8 +23,6 @@
 #include "llvm/Debugger/SourceLanguage.h"
 #include "llvm/Support/SlowOperationInformer.h"
 #include "llvm/ADT/STLExtras.h"
-#include <iostream>
-
 using namespace llvm;
 
 /// getGlobalVariablesUsing - Return all of the global variables which have the
@@ -181,8 +179,8 @@ void SourceFunctionInfo::getSourceLocation(unsigned &RetLineNo,
             if (SD) {             // We found the first stop point!
               // This is just a sanity check.
               if (getSourceFile().getDescriptor() != SD)
-                std::cout << "WARNING: first line of function is not in the"
-                  " file that the function descriptor claims it is in.\n";
+                cout << "WARNING: first line of function is not in the"
+                     << " file that the function descriptor claims it is in.\n";
               break;
             }
           }
index 22376f8e2d2d8dc6d4c8070601a708559559061f..276ae9fcaf72d2f55d4097e0890b10abaa483a45 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "llvm/Debugger/SourceLanguage.h"
 #include "llvm/Debugger/ProgramInfo.h"
-#include <iostream>
+#include "llvm/Support/Streams.h"
 #include <cassert>
 using namespace llvm;
 
@@ -131,7 +131,7 @@ SourceFunctionInfo *SLU::lookupFunction(const std::string &FunctionName,
   SourceFunctionInfo *Found = IP.first->second;
   ++IP.first;
   if (IP.first != IP.second)
-    std::cout << "Whoa, found multiple functions with the same name.  I should"
-              << " ask the user which one to use: FIXME!\n";
+    cout << "Whoa, found multiple functions with the same name.  I should"
+         << " ask the user which one to use: FIXME!\n";
   return Found;
 }
index 19cfff33aacbfda9d269e1463f3129152e4f05d1..8c082712358bd0da586fbd9f81464cb62051b700 100644 (file)
@@ -23,9 +23,8 @@
 
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/ADT/StringExtras.h"
-#include <sstream>
-#include <iostream>
 #include <algorithm>
 using namespace llvm;
 
@@ -100,7 +99,7 @@ Statistic::~Statistic() {
     // Free all accumulated statistics...
     delete AccumStats;
     AccumStats = 0;
-    if (OutStream != &std::cerr && OutStream != &std::cout)
+    if (OutStream != cerr.stream() && OutStream != cout.stream())
       delete OutStream;   // Close the file...
   }
 }
index 124251165d65509b1ae85cf5bf15579a934412aa..1d2c1086aea481932d0e7323dcee6a31ec0b4d08 100644 (file)
 #include "llvm/Support/SystemUtils.h"
 #include "llvm/System/Process.h"
 #include "llvm/System/Program.h"
-#include <iostream>
 using namespace llvm;
 
 bool llvm::CheckBytecodeOutputToConsole(std::ostream* stream_to_check,
                                         bool print_warning) {
-  if (stream_to_check == &std::cout && sys::Process::StandardOutIsDisplayed()) {
+  if (stream_to_check == cout.stream() &&
+      sys::Process::StandardOutIsDisplayed()) {
     if (print_warning) {
       cerr << "WARNING: You're attempting to print out a bytecode file.\n"
            << "This is inadvisable as it may cause display problems. If\n"
index a39f169cb7bed35d547d40de9b806473a44700cc..077995d9fb8993a21d4a07120d20e1c366b0854a 100644 (file)
 #include "llvm/Support/Timer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/System/Process.h"
 #include <algorithm>
 #include <fstream>
 #include <functional>
-#include <iostream>
 #include <map>
 using namespace llvm;
 
@@ -263,17 +263,17 @@ std::ostream *
 llvm::GetLibSupportInfoOutputFile() {
   std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
   if (LibSupportInfoOutputFilename.empty())
-    return &std::cerr;
+    return cerr.stream();
   if (LibSupportInfoOutputFilename == "-")
-    return &std::cout;
+    return cout.stream();
 
   std::ostream *Result = new std::ofstream(LibSupportInfoOutputFilename.c_str(),
                                            std::ios::app);
   if (!Result->good()) {
-    std::cerr << "Error opening info-output-file '"
-              << LibSupportInfoOutputFilename << " for appending!\n";
+    cerr << "Error opening info-output-file '"
+         << LibSupportInfoOutputFilename << " for appending!\n";
     delete Result;
-    return &std::cerr;
+    return cerr.stream();
   }
   return Result;
 }
@@ -342,7 +342,7 @@ void TimerGroup::removeTimer() {
 
     TimersToPrint.clear();
 
-    if (OutStream != &std::cerr && OutStream != &std::cout)
+    if (OutStream != cerr.stream() && OutStream != cout.stream())
       delete OutStream;   // Close the file...
   }