[llvm-commits] [llvm] r82570 - /llvm/trunk/include/llvm/Support/IRBuilder.h

Devang Patel dpatel at apple.com
Tue Sep 22 13:56:32 PDT 2009


Author: dpatel
Date: Tue Sep 22 15:56:31 2009
New Revision: 82570

URL: http://llvm.org/viewvc/llvm-project?rev=82570&view=rev
Log:
Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.

Modified:
    llvm/trunk/include/llvm/Support/IRBuilder.h

Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=82570&r1=82569&r2=82570&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Sep 22 15:56:31 2009
@@ -131,8 +131,8 @@
     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 @@
   }
 
   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 {





More information about the llvm-commits mailing list