Fix GetConstantStringInfo to not look into MDString (it works on

real data, not metadata) and fix DbgInfoPrinter to not abuse
GetConstantStringInfo.

llvm-svn: 91444
This commit is contained in:
Chris Lattner 2009-12-15 19:34:20 +00:00
parent 38c4f4b5d1
commit a3aef788ec
2 changed files with 7 additions and 15 deletions

View File

@ -22,7 +22,6 @@
#include "llvm/Assembly/Writer.h" #include "llvm/Assembly/Writer.h"
#include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/DebugInfo.h"
#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Support/CFG.h" #include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
@ -75,18 +74,16 @@ void PrintDbgInfo::printVariableDeclaration(const Value *V) {
} }
void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) { void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) {
if (PrintDirectory) { if (PrintDirectory)
std::string dir; if (MDString *Str = dyn_cast<MDString>(DSI->getDirectory()))
GetConstantStringInfo(DSI->getDirectory(), dir); Out << Str->getString() << '/';
Out << dir << "/";
}
std::string file; if (MDString *Str = dyn_cast<MDString>(DSI->getFileName()))
GetConstantStringInfo(DSI->getFileName(), file); Out << Str->getString();
Out << file << ":" << DSI->getLine(); Out << ':' << DSI->getLine();
if (unsigned Col = DSI->getColumn()) if (unsigned Col = DSI->getColumn())
Out << ":" << Col; Out << ':' << Col;
} }
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) { void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) {

View File

@ -1369,11 +1369,6 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
StopAtNul); StopAtNul);
} }
if (MDString *MDStr = dyn_cast<MDString>(V)) {
Str = MDStr->getString();
return true;
}
// The GEP instruction, constant or instruction, must reference a global // The GEP instruction, constant or instruction, must reference a global
// variable that is a constant and is initialized. The referenced constant // variable that is a constant and is initialized. The referenced constant
// initializer is the array that we'll use for optimization. // initializer is the array that we'll use for optimization.