string to value

Hi All,
Is there a way to convert a const char * to a Value type?
Thanks.

George

Could you be more specific? Are you looking to make a string literal a Value? If so, then you need to create a Constant of the string first (a constant array of i8), then create a GlobalVariable with that type, and then initialize that GlobalVariable with the Constant.

-bw

Hi George,

   Is there a way to convert a const char * to a Value type?

there's this ConstantArray::get method:

   /// This method constructs a ConstantArray and initializes it with a text
   /// string. The default behavior (AddNull==true) causes a null terminator to
   /// be placed at the end of the array. This effectively increases the length
   /// of the array by one (you've been warned). However, in some situations
   /// this is not desired so if AddNull==false then the string is copied without
   /// null termination.
   static Constant *get(LLVMContext &Context, StringRef Initializer,
                        bool AddNull = true);

Ciao, Duncan.