Add SetDebugLocation() variant to
authorDevang Patel <dpatel@apple.com>
Wed, 11 Nov 2009 19:06:06 +0000 (19:06 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 11 Nov 2009 19:06:06 +0000 (19:06 +0000)
add debug info location to an instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86859 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/IRBuilder.h

index 4652e8fb941706b9cd8402387ce7a6f04964d643..05c3c569aa1a7a4fbde2da64d343c4fe313ec819 100644 (file)
@@ -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 {