Add a newline to the end of this file.
[oota-llvm.git] / lib / Analysis / IPA / FindUsedTypes.cpp
index f7efc7d3a4157efb9a876e6e8cd0b95701444a75..a954414b43952e9a177f43daa2459edaf9ff7b1d 100644 (file)
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
-#include "llvm/Assembly/CachedWriter.h"
+#include "llvm/Assembly/Writer.h"
 #include "llvm/Support/InstIterator.h"
 using namespace llvm;
 
-static RegisterAnalysis<FindUsedTypes>
+char FindUsedTypes::ID = 0;
+static RegisterPass<FindUsedTypes>
 X("printusedtypes", "Find Used Types");
 
-// stub to help linkage
-int FindUsedTypes::stub; // to ensure linkage of this file
-
 // IncorporateType - Incorporate one type and all of its subtypes into the
 // collection of used types.
 //
@@ -94,13 +92,10 @@ bool FindUsedTypes::runOnModule(Module &m) {
 //
 void FindUsedTypes::print(std::ostream &o, const Module *M) const {
   o << "Types in use by this module:\n";
-  if (M) {
-    CachedWriter CW(M, o);
-    for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
-           E = UsedTypes.end(); I != E; ++I)
-      CW << "  " << **I << "\n";
-  } else
-    for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
-           E = UsedTypes.end(); I != E; ++I)
-      o << "  " << **I << "\n";
+  for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
+       E = UsedTypes.end(); I != E; ++I)
+    WriteTypeSymbolic(o << "  ", *I, M) << "\n";
 }
+
+// Ensure that this file gets linked in when FindUsedTypes.h is used.
+DEFINING_FILE_FOR(FindUsedTypes)