Skip to content

Commit

Permalink
make irbuilder use the new optimized debug info accessors.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99984 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Mar 31, 2010
1 parent 870cfcf commit 5169c9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
15 changes: 11 additions & 4 deletions include/llvm/Support/IRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class IRBuilderDefaultInserter {

/// IRBuilderBase - Common base class shared among various IRBuilders.
class IRBuilderBase {
unsigned DbgMDKind;
MDNode *CurDbgLocation;
protected:
BasicBlock *BB;
Expand All @@ -49,7 +48,7 @@ class IRBuilderBase {
public:

IRBuilderBase(LLVMContext &context)
: DbgMDKind(0), CurDbgLocation(0), Context(context) {
: CurDbgLocation(0), Context(context) {
ClearInsertionPoint();
}

Expand Down Expand Up @@ -82,12 +81,20 @@ class IRBuilderBase {

/// SetCurrentDebugLocation - Set location information used by debugging
/// information.
void SetCurrentDebugLocation(MDNode *L);
void SetCurrentDebugLocation(MDNode *L) {
CurDbgLocation = L;
}

/// SetCurrentDebugLocation - Set location information used by debugging
/// information.
MDNode *getCurrentDebugLocation() const { return CurDbgLocation; }

/// SetInstDebugLocation - If this builder has a current debug location, set
/// it on the specified instruction.
void SetInstDebugLocation(Instruction *I) const;
void SetInstDebugLocation(Instruction *I) const {
if (CurDbgLocation)
I->setDbgMetadata(CurDbgLocation);
}

//===--------------------------------------------------------------------===//
// Miscellaneous creation methods.
Expand Down
13 changes: 0 additions & 13 deletions lib/VMCore/IRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,6 @@ Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) {
return GV;
}

/// SetCurrentDebugLocation - Set location information used by debugging
/// information.
void IRBuilderBase::SetCurrentDebugLocation(MDNode *L) {
if (DbgMDKind == 0)
DbgMDKind = Context.getMDKindID("dbg");
CurDbgLocation = L;
}

void IRBuilderBase::SetInstDebugLocation(Instruction *I) const {
if (CurDbgLocation)
I->setMetadata(DbgMDKind, CurDbgLocation);
}

const Type *IRBuilderBase::getCurrentFunctionReturnType() const {
assert(BB && BB->getParent() && "No current function!");
return BB->getParent()->getReturnType();
Expand Down

0 comments on commit 5169c9e

Please sign in to comment.