aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/DbgInfoPrinter.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-03-13 04:39:26 +0000
committerBill Wendling <isanbard@gmail.com>2009-03-13 04:39:26 +0000
commit0582ae99ba75a556d6ff63b254da327d32ba036f (patch)
treef6acdc868987413752d785dabab58cbb8e72e6b1 /lib/Analysis/DbgInfoPrinter.cpp
parentc7a09ab3110b9462ad9646cb60c22c8527491ad9 (diff)
downloadexternal_llvm-0582ae99ba75a556d6ff63b254da327d32ba036f.zip
external_llvm-0582ae99ba75a556d6ff63b254da327d32ba036f.tar.gz
external_llvm-0582ae99ba75a556d6ff63b254da327d32ba036f.tar.bz2
Oops...I committed too much.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DbgInfoPrinter.cpp')
-rw-r--r--lib/Analysis/DbgInfoPrinter.cpp48
1 files changed, 26 insertions, 22 deletions
diff --git a/lib/Analysis/DbgInfoPrinter.cpp b/lib/Analysis/DbgInfoPrinter.cpp
index 6346a90..e43bc81 100644
--- a/lib/Analysis/DbgInfoPrinter.cpp
+++ b/lib/Analysis/DbgInfoPrinter.cpp
@@ -33,29 +33,31 @@ static cl::opt<bool>
PrintDirectory("print-fullpath", cl::desc("Print fullpath when printing debug info"), cl::Hidden);
namespace {
- struct VISIBILITY_HIDDEN PrintDbgInfo : public FunctionPass {
+ struct VISIBILITY_HIDDEN PrintDbgInfo : public FunctionPass {
private:
raw_ostream &Out;
void printStopPoint(const DbgStopPointInst *DSI);
void printFuncStart(const DbgFuncStartInst *FS);
void printVariableDeclaration(const Value *V);
- public:
- static char ID; // Pass identification
- PrintDbgInfo() : FunctionPass(&ID), Out(outs()) {}
+ public:
+ static char ID; // Pass identification
+ PrintDbgInfo() : FunctionPass(&ID), Out(outs()) {}
- virtual bool runOnFunction(Function &F);
- virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- }
- };
- char PrintDbgInfo::ID = 0;
- static RegisterPass<PrintDbgInfo> X("print-dbginfo",
- "Print debug info in human readable form");
+ virtual bool runOnFunction(Function &F);
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+
+ };
+ char PrintDbgInfo::ID = 0;
+ static RegisterPass<PrintDbgInfo> X("print-dbginfo",
+ "Print debug info in human readable form");
}
FunctionPass *llvm::createDbgInfoPrinterPass() { return new PrintDbgInfo(); }
-void PrintDbgInfo::printVariableDeclaration(const Value *V) {
+void PrintDbgInfo::printVariableDeclaration(const Value *V)
+{
std::string DisplayName, File, Directory, Type;
unsigned LineNo;
if (getLocationInfo(V, DisplayName, Type, LineNo, File, Directory)) {
@@ -73,22 +75,24 @@ void PrintDbgInfo::printVariableDeclaration(const Value *V) {
void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI)
{
if (PrintDirectory) {
- const char *Dir = GetConstantStringInfo(DSI->getDirectory());
- Out << (Dir ? Dir : "") << "/";
+ std::string dir;
+ GetConstantStringInfo(DSI->getDirectory(), dir);
+ Out << dir << "/";
}
-
- const char *FN = GetConstantStringInfo(DSI->getFileName());
- Out << (FN ? FN : "") << ":" << DSI->getLine();
-
- if (unsigned Col = DSI->getColumn())
+ std::string file;
+ GetConstantStringInfo(DSI->getFileName(), file);
+ Out << file << ":" << DSI->getLine();
+ if (unsigned Col = DSI->getColumn()) {
Out << ":" << Col;
+ }
}
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS)
{
DISubprogram Subprogram(cast<GlobalVariable>(FS->getSubprogram()));
- Out << ";fully qualified function name: " << Subprogram.getDisplayName()
- << " return type: " << Subprogram.getType().getName()
+ std::string Res1, Res2;
+ Out << ";fully qualified function name: " << Subprogram.getDisplayName(Res1)
+ << " return type: " << Subprogram.getType().getName(Res2)
<< " at line " << Subprogram.getLineNumber()
<< "\n\n";
}