summaryrefslogtreecommitdiffstats
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-01 06:31:45 +0000
committerChris Lattner <sabre@nondot.org>2010-04-01 06:31:45 +0000
commita41b9153c3e568c874eb777d2b295659a9aca10a (patch)
tree501d19b50f4997e21e6fc3de4351ffacb1e82d2b /include/llvm/Support
parentf0100ff3f6adb41d257ab5bff5fef390a8f458e2 (diff)
downloadexternal_llvm-a41b9153c3e568c874eb777d2b295659a9aca10a.zip
external_llvm-a41b9153c3e568c874eb777d2b295659a9aca10a.tar.gz
external_llvm-a41b9153c3e568c874eb777d2b295659a9aca10a.tar.bz2
switch IRBuilder to use NewDebugLoc for locations instead
of raw mdnodes. This allows frontends to specify debug locations without ever creating an MDNode for the DILocation. This requires a corresponding clang/llvm-gcc change which I'll try to commit as simultaneously as possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100095 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/IRBuilder.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 43b6e62..c352625 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -40,7 +40,7 @@ protected:
/// IRBuilderBase - Common base class shared among various IRBuilders.
class IRBuilderBase {
- MDNode *CurDbgLocation;
+ NewDebugLoc CurDbgLocation;
protected:
BasicBlock *BB;
BasicBlock::iterator InsertPt;
@@ -48,7 +48,7 @@ protected:
public:
IRBuilderBase(LLVMContext &context)
- : CurDbgLocation(0), Context(context) {
+ : Context(context) {
ClearInsertionPoint();
}
@@ -64,6 +64,7 @@ public:
BasicBlock *GetInsertBlock() const { return BB; }
BasicBlock::iterator GetInsertPoint() const { return InsertPt; }
+ LLVMContext &getContext() const { return Context; }
/// SetInsertPoint - This specifies that created instructions should be
/// appended to the end of the specified block.
@@ -81,19 +82,19 @@ public:
/// SetCurrentDebugLocation - Set location information used by debugging
/// information.
- void SetCurrentDebugLocation(MDNode *L) {
+ void SetCurrentDebugLocation(const NewDebugLoc &L) {
CurDbgLocation = L;
}
/// getCurrentDebugLocation - Get location information used by debugging
/// information.
- MDNode *getCurrentDebugLocation() const { return CurDbgLocation; }
+ const NewDebugLoc &getCurrentDebugLocation() const { return CurDbgLocation; }
/// SetInstDebugLocation - If this builder has a current debug location, set
/// it on the specified instruction.
void SetInstDebugLocation(Instruction *I) const {
- if (CurDbgLocation)
- I->setDbgMetadata(CurDbgLocation);
+ if (!CurDbgLocation.isUnknown())
+ I->setDebugLoc(CurDbgLocation);
}
//===--------------------------------------------------------------------===//
@@ -215,7 +216,7 @@ public:
template<typename InstTy>
InstTy *Insert(InstTy *I, const Twine &Name = "") const {
this->InsertHelper(I, Name, BB, InsertPt);
- if (getCurrentDebugLocation() != 0)
+ if (!getCurrentDebugLocation().isUnknown())
this->SetInstDebugLocation(I);
return I;
}