Convert debug messages to use dbgs(). Generally this means
[oota-llvm.git] / lib / Analysis / DbgInfoPrinter.cpp
index d80d5811e0966f31ebb12ed1d135bdcc658464ee..b90a996d820c9b5d984093473073611a45175833 100644 (file)
@@ -22,7 +22,6 @@
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Analysis/DebugInfo.h"
 #include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/ValueTracking.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
@@ -35,7 +34,7 @@ PrintDirectory("print-fullpath",
                cl::Hidden);
 
 namespace {
-  class VISIBILITY_HIDDEN PrintDbgInfo : public FunctionPass {
+  class PrintDbgInfo : public FunctionPass {
     raw_ostream &Out;
     void printStopPoint(const DbgStopPointInst *DSI);
     void printFuncStart(const DbgFuncStartInst *FS);
@@ -75,25 +74,22 @@ void PrintDbgInfo::printVariableDeclaration(const Value *V) {
 }
 
 void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) {
-  if (PrintDirectory) {
-    std::string dir;
-    GetConstantStringInfo(DSI->getDirectory(), dir);
-    Out << dir << "/";
-  }
+  if (PrintDirectory)
+    if (MDString *Str = dyn_cast<MDString>(DSI->getDirectory()))
+      Out << Str->getString() << '/';
 
-  std::string file;
-  GetConstantStringInfo(DSI->getFileName(), file);
-  Out << file << ":" << DSI->getLine();
+  if (MDString *Str = dyn_cast<MDString>(DSI->getFileName()))
+    Out << Str->getString();
+  Out << ':' << DSI->getLine();
 
   if (unsigned Col = DSI->getColumn())
-    Out << ":" << Col;
+    Out << ':' << Col;
 }
 
 void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) {
-  DISubprogram Subprogram(cast<GlobalVariable>(FS->getSubprogram()));
-  std::string Res1, Res2;
-  Out << "; fully qualified function name: " << Subprogram.getDisplayName(Res1)
-      << " return type: " << Subprogram.getType().getName(Res2)
+  DISubprogram Subprogram(FS->getSubprogram());
+  Out << "; fully qualified function name: " << Subprogram.getDisplayName()
+      << " return type: " << Subprogram.getReturnTypeName()
       << " at line " << Subprogram.getLineNumber()
       << "\n\n";
 }
@@ -152,7 +148,7 @@ bool PrintDbgInfo::runOnFunction(Function &F) {
           Printed = true;
         }
 
-        Out << *i;
+        Out << *i << '\n';
         printVariableDeclaration(i);
 
         if (const User *U = dyn_cast<User>(i)) {