diff options
author | Devang Patel <dpatel@apple.com> | 2009-09-22 20:56:31 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-09-22 20:56:31 +0000 |
commit | 191278d73343733b56e030ace8f6a9dcdf08818a (patch) | |
tree | f9da621f7ad2bbea05b101aa891f4dd3b6341b7f /include/llvm | |
parent | 5ffdd0e9c3eb03b473ddf666c885cecbc15f8df7 (diff) | |
download | external_llvm-191278d73343733b56e030ace8f6a9dcdf08818a.zip external_llvm-191278d73343733b56e030ace8f6a9dcdf08818a.tar.gz external_llvm-191278d73343733b56e030ace8f6a9dcdf08818a.tar.bz2 |
Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Support/IRBuilder.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index a948e9f..79df7cd 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 { |