[cfe-commits] r157583 - in /cfe/trunk: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/mangle-ms-templates.cpp

Jordy Rose jediknil at belkadan.com
Mon May 28 10:07:45 PDT 2012


On May 28, 2012, at 9:53, Charles Davis wrote:

> Author: cdavis
> Date: Mon May 28 11:53:33 2012
> New Revision: 157583
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=157583&view=rev
> Log:
> Fix mangling of integral template arguments between 1 and 10. Add a test case
> for this. Reported by Timur Iskhodzhanov.
> 
> Modified:
>    cfe/trunk/lib/AST/MicrosoftMangle.cpp
>    cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
> 
> Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=157583&r1=157582&r2=157583&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
> +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Mon May 28 11:53:33 2012
> @@ -309,8 +309,8 @@
>     return;
>   }
>   if (Value.uge(1) && Value.ule(10))
> -    (Value-llvm::APSInt(llvm::APInt(Value.getBitWidth(), 1, Value.isSigned()))).print(Out,
> -                                                                                   false);
> +    (Value-llvm::APSInt(llvm::APInt(Value.getBitWidth(), 1, Value.isSigned()),
> +                        Value.isUnsigned())).print(Out, false);
>   else {
>     // We have to build up the encoding in reverse order, so it will come
>     // out right when we write it out.


Since the value are known-positive now, how about this:

llvm::APSInt PrintValue(Value);
--PrintValue;
PrintValue.print(Out, false);

It seems clearer to me, and it uses fewer temporaries.

Jordy





More information about the cfe-commits mailing list