porting to 3.1: ConstantDataArray

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

porting to 3.1: ConstantDataArray

charles quarra
Hi,

In llvm 3.0 llvm::ConstantArray had a ::getAsCString() method that
returned the buffer as a std::string. Now it seems that 3.1 this
method dissapeared.

I found that llvm::ConstantDataArray has a method called
getAsString(), but it returns a Constant*.

What is the safe way to retrieve the pointer of the Constant array as
a C string?
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: porting to 3.1: ConstantDataArray

Jay Foad-2
On 16 November 2012 13:55, charles quarra
<[hidden email]> wrote:
> In llvm 3.0 llvm::ConstantArray had a ::getAsCString() method that
> returned the buffer as a std::string. Now it seems that 3.1 this
> method dissapeared.
>
> I found that llvm::ConstantDataArray has a method called
> getAsString(), but it returns a Constant*.

In 3.1 ConstantDataArray has a getAsCString() which is exactly what
you want. See here line 623:

http://llvm.org/viewvc/llvm-project/llvm/tags/RELEASE_31/final/include/llvm/Constants.h?view=annotate

Jay.
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: porting to 3.1: ConstantDataArray

charles quarra
oh myy it is indeed, i should've been written it incorrectly. sorry! and thanks

2012/11/16 Jay Foad <[hidden email]>:

> On 16 November 2012 13:55, charles quarra
> <[hidden email]> wrote:
>> In llvm 3.0 llvm::ConstantArray had a ::getAsCString() method that
>> returned the buffer as a std::string. Now it seems that 3.1 this
>> method dissapeared.
>>
>> I found that llvm::ConstantDataArray has a method called
>> getAsString(), but it returns a Constant*.
>
> In 3.1 ConstantDataArray has a getAsCString() which is exactly what
> you want. See here line 623:
>
> http://llvm.org/viewvc/llvm-project/llvm/tags/RELEASE_31/final/include/llvm/Constants.h?view=annotate
>
> Jay.
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev