Replace DEBUG(std::cerr with DOUT. Removed some iostream #includes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31811 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 15c6c75..505fe91 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -431,8 +431,7 @@
 ///
 bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
                            bool FoldIfIncompatible) {
-  DEBUG(std::cerr << "merging " << *NewTy << " at " << Offset 
-                  << " with " << *Ty << "\n");
+  DOUT << "merging " << *NewTy << " at " << Offset << " with " << *Ty << "\n";
   const TargetData &TD = getTargetData();
   // Check to make sure the Size member is up-to-date.  Size can be one of the
   // following:
@@ -521,9 +520,10 @@
       //handle some common cases:
       // Ty:    struct { t1, t2, t3, t4, ..., tn}
       // NewTy: struct { offset, stuff...}
-      // try merge with NewTy: struct {t1, t2, stuff...} if offset lands exactly on a field in Ty
+      // try merge with NewTy: struct {t1, t2, stuff...} if offset lands exactly
+      // on a field in Ty
       if (isa<StructType>(NewTy) && isa<StructType>(Ty)) {
-        DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n");
+        DOUT << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n";
         const StructType *STy = cast<StructType>(Ty);
         const StructLayout &SL = *TD.getStructLayout(STy);
         unsigned i = SL.getElementContainingOffset(Offset);
@@ -539,15 +539,16 @@
         nt.insert(nt.end(), STy->element_begin(), STy->element_end());
         //and merge
         STy = StructType::get(nt);
-        DEBUG(std::cerr << "Trying with: " << *STy << "\n");
+        DOUT << "Trying with: " << *STy << "\n";
         return mergeTypeInfo(STy, 0);
       }
 
       //Ty: struct { t1, t2, t3 ... tn}
       //NewTy T offset x
-      //try merge with NewTy: struct : {t1, t2, T} if offset lands on a field in Ty
+      //try merge with NewTy: struct : {t1, t2, T} if offset lands on a field
+      //in Ty
       if (isa<StructType>(Ty)) {
-        DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n");
+        DOUT << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n";
         const StructType *STy = cast<StructType>(Ty);
         const StructLayout &SL = *TD.getStructLayout(STy);
         unsigned i = SL.getElementContainingOffset(Offset);
@@ -562,12 +563,13 @@
         nt.push_back(NewTy);
         //and merge
         STy = StructType::get(nt);
-        DEBUG(std::cerr << "Trying with: " << *STy << "\n");
+        DOUT << "Trying with: " << *STy << "\n";
         return mergeTypeInfo(STy, 0);
       }
 
-      std::cerr << "UNIMP: Trying to merge a growth type into "
-                << "offset != 0: Collapsing!\n";
+      assert(0 &&
+             "UNIMP: Trying to merge a growth type into "
+             "offset != 0: Collapsing!");
       abort();
       if (FoldIfIncompatible) foldNodeCompletely();
       return true;
@@ -717,10 +719,11 @@
   Module *M = 0;
   if (getParentGraph()->retnodes_begin() != getParentGraph()->retnodes_end())
     M = getParentGraph()->retnodes_begin()->first->getParent();
-  DEBUG(std::cerr << "MergeTypeInfo Folding OrigTy: ";
-        WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:";
+
+  DOUT << "MergeTypeInfo Folding OrigTy: ";
+  DEBUG(WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:";
         WriteTypeSymbolic(std::cerr, NewTy, M) << " @ " << Offset << "!\n"
-                  << "SubType: ";
+                                               << "SubType: ";
         WriteTypeSymbolic(std::cerr, SubType, M) << "\n\n");
 
   if (FoldIfIncompatible) foldNodeCompletely();
@@ -926,8 +929,7 @@
   if (N == this) {
     // We cannot merge two pieces of the same node together, collapse the node
     // completely.
-    DEBUG(std::cerr << "Attempting to merge two chunks of"
-                    << " the same node together!\n");
+    DOUT << "Attempting to merge two chunks of the same node together!\n";
     foldNodeCompletely();
     return;
   }
@@ -1808,9 +1810,7 @@
       // eliminate it.
       if (Callee->getNumReferrers() == 1 && Callee->isComplete() &&
           Callee->getGlobalsList().empty()) {  // No useful info?
-#ifndef NDEBUG
-        std::cerr << "WARNING: Useless call site found.\n";
-#endif
+        DOUT << "WARNING: Useless call site found.\n";
         Calls.erase(OldIt);
         ++NumDeleted;
         continue;
@@ -1930,8 +1930,8 @@
   // Track the number of call nodes merged away...
   NumCallNodesMerged += NumDeleted;
 
-  DEBUG(if (NumDeleted)
-          std::cerr << "Merged " << NumDeleted << " call nodes.\n";);
+  if (NumDeleted)
+    DOUT << "Merged " << NumDeleted << " call nodes.\n";
 }
 
 
@@ -2263,7 +2263,7 @@
 #if 0
     if (CS.getNumPtrArgs() && CS.getCalleeNode() == CS.getPtrArg(0).getNode() &&
         CS.getCalleeNode() && CS.getCalleeNode()->getGlobals().empty())
-      std::cerr << "WARNING: WEIRD CALL SITE FOUND!\n";
+      DOUT << "WARNING: WEIRD CALL SITE FOUND!\n";
 #endif
   }
   AssertNodeInGraph(CS.getRetVal().getNode());