From 4a8efb0c397efc7a60c532d7534b155c53cb1ef7 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 11 Nov 2009 19:06:06 +0000 Subject: [PATCH] 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 --- include/llvm/Support/IRBuilder.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index 4652e8fb941..05c3c569aa1 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 InstTy *Insert(InstTy *I, const Twine &Name = "") const { -- 2.34.1