aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-11-11 19:06:06 +0000
committerDevang Patel <dpatel@apple.com>2009-11-11 19:06:06 +0000
commit4a8efb0c397efc7a60c532d7534b155c53cb1ef7 (patch)
treec8ec4292bc38f9f583d723a98fa6a9bd540621a3
parent77e4751011da2d6afa930ab91f7baee39e7c7e89 (diff)
Add SetDebugLocation() variant to
add debug info location to an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86859 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/IRBuilder.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 4652e8fb94..05c3c569aa 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -151,6 +151,15 @@ public:
Context.getMetadata().addMD(MDKind, CurDbgLocation, I);
}
+ /// SetDebugLocation - Set location information for the given instruction.
+ void SetDebugLocation(Instruction *I, MDNode *Loc) {
+ if (MDKind == 0)
+ MDKind = Context.getMetadata().getMDKind("dbg");
+ if (MDKind == 0)
+ MDKind = Context.getMetadata().registerMDKind("dbg");
+ Context.getMetadata().addMD(MDKind, Loc, I);
+ }
+
/// Insert - Insert and return the specified instruction.
template<typename InstTy>
InstTy *Insert(InstTy *I, const Twine &Name = "") const {