Add SetLocation() to allow IRBuilder user to set location info for an instruction...
authorDevang Patel <dpatel@apple.com>
Tue, 22 Sep 2009 20:56:31 +0000 (20:56 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 22 Sep 2009 20:56:31 +0000 (20:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82570 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/IRBuilder.h

index a948e9f09d2e15fa02ef1a899598ca9e2ce28cc6..79df7cdc0a17a90d4ea04826e84ea2ed7f1ae21a 100644 (file)
@@ -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 {