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

Chris Lattner clattner at apple.com
Tue Sep 22 18:50:01 PDT 2009


On Sep 22, 2009, at 1:56 PM, Devang Patel wrote:

> 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

Devang,  Builder->SetLocation(I)  sounds like it sets the location of  
the builder, not the instruction.  Can you pick a better name for this?

SetCurrentLocation also has a similar problem.  How about  
SetDebugLocation() ?

-Chris

>
> 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 {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list