[llvm-dev] How to convert an APSInt to string in llvm-13?

Simon Pilgrim via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 6 08:13:12 PST 2022


We made this change in https://reviews.llvm.org/D103888 which has 
examples of the refactor necessary.

You should be able to use the llvm::toString(const APSInt &I, unsigned 
Radix) helper found in StringExtras.h

But if you're always wanting Radix = 10, you might be able to just 
stream the APSInt directly:

os << '[' << i->From() << ", " << i->To() << ']';

Simon.

On 06/01/2022 15:44, Alberto Barbaro via llvm-dev wrote:
> Hello,
> until llvm-12 i could convert an APSInt to string just using 
> toString() but now in llvm-13 I think I'm supposed to use a different 
> version of toString(). I tried multiple times but nothing so far.
>
> Could you help me to "convert" this line os << '[' << 
> i->From().toString(10) << ", " << i->To().toString(10) << ']';?
>
> Thanks
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list