summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Support/IRBuilder.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index a948e9f09d..79df7cdc0a 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -131,8 +131,8 @@ public:
InsertPt = IP;
}
- /// SetCurrentLocation - This specifies the location information used
- /// by debugging information.
+ /// SetCurrentLocation - Set location information used by debugging
+ /// information.
void SetCurrentLocation(MDNode *L) {
if (MDKind == 0)
MDKind = Context.getMetadata().getMDKind("dbg");
@@ -142,7 +142,13 @@ public:
}
MDNode *getCurrentLocation() const { return CurLocation; }
-
+
+ /// SetLocation - Set location information for the given instruction.
+ void SetLocation(Instruction *I) {
+ if (CurLocation)
+ Context.getMetadata().setMD(MDKind, CurLocation, I);
+ }
+
/// Insert - Insert and return the specified instruction.
template<typename InstTy>
InstTy *Insert(InstTy *I, const Twine &Name = "") const {