[llvm-commits] [llvm] r77579 - in /llvm/trunk/lib: Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Transforms/IPO/ArgumentPromotion.cpp Transforms/IPO/GlobalOpt.cpp Transforms/Scalar/ScalarReplAggregates.cpp Transforms/Utils/PromoteMemoryToRegister.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jul 29 23:07:52 PDT 2009


On 30/07/2009, at 06.20, Daniel Dunbar wrote:
> Switch obvious clients to Twine instead of utostr (when they were  
> already using
> a Twine, e.g., for names).
> - I am a little ambivalent about this; we don't want the string  
> conversion of
>   utostr, but using overload '+' mixed with string and integer  
> arguments is
>   sketchy. On the other hand, this particular usage is something of  
> an idiom.

Me too.

> -                                    TheAlloca->getName() 
> +"."+utostr(i),
> +                                    TheAlloca->getName()+"."+i,

The problem with this kind of expression is that you have to be a  
language lawyer to find out what it does. The meaning of "."+i changes  
completely because operator+ is left-associative. What is worse, the  
compiler would be happy either way.

Would it be possible to use something a little less magic? Perhaps an  
explicit Twine constructor:

     explicit Twine(const int64_t &Val)  ...

    TheAlloca->getName()+"."+Twine(i)

/jakob




More information about the llvm-commits mailing list