diff --git a/llvm/include/llvm/Support/IRBuilder.h b/llvm/include/llvm/Support/IRBuilder.h index 4652e8fb9417..05c3c569aa1a 100644 --- a/llvm/include/llvm/Support/IRBuilder.h +++ b/llvm/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 {