* Standardize how analysis results/passes as printed with the print() virtual
  methods
* Eliminate AnalysisID:  Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
  the analyses themselves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3115 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp
index 4a58c69..03ce297 100644
--- a/lib/Analysis/DataStructure/Printer.cpp
+++ b/lib/Analysis/DataStructure/Printer.cpp
@@ -147,16 +147,21 @@
 }
 
 template <typename Collection>
-static void printCollection(const Collection &C, std::ostream &O, Module *M,
-                            const string &Prefix) {
-  for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
+static void printCollection(const Collection &C, std::ostream &O,
+                            const Module *M, const string &Prefix) {
+  if (M == 0) {
+    O << "Null Module pointer, cannot continue!\n";
+    return;
+  }
+
+  for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
     if (!I->isExternal()) {
       string Filename = Prefix + "." + I->getName() + ".dot";
       O << "Writing '" << Filename << "'...";
       std::ofstream F(Filename.c_str());
       
       if (F.good()) {
-        DSGraph &Graph = C.getDSGraph(*I);
+        DSGraph &Graph = C.getDSGraph((Function&)*I);
         Graph.print(F);
         O << " [" << Graph.getGraphSize() << "+"
           << Graph.getFunctionCalls().size() << "]\n";
@@ -168,10 +173,10 @@
 
 
 // print - Print out the analysis results...
-void LocalDataStructures::print(std::ostream &O, Module *M) const {
+void LocalDataStructures::print(std::ostream &O, const Module *M) const {
   printCollection(*this, O, M, "ds");
 }
 
-void BUDataStructures::print(std::ostream &O, Module *M) const {
+void BUDataStructures::print(std::ostream &O, const Module *M) const {
   printCollection(*this, O, M, "bu");
 }