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

Nico Weber thakis at chromium.org
Wed Oct 3 06:42:30 PDT 2012


This was PR14006.

On Wed, Oct 3, 2012 at 10:39 PM, Nico Weber <nicolasweber at gmx.de> wrote:
> Author: nico
> Date: Wed Oct  3 08:39:49 2012
> New Revision: 165116
>
> URL: http://llvm.org/viewvc/llvm-project?rev=165116&view=rev
> Log:
> When mangling an APSInt with the ms abi, make sure to look at all nibbles.
>
> Currently, it's ignored if the number of set bits isn't divisible by 4.
>
>
> 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=165116&r1=165115&r2=165116&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
> +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Oct  3 08:39:49 2012
> @@ -350,7 +350,7 @@
>      char *CurPtr = EndPtr;
>      llvm::APSInt NibbleMask(Value.getBitWidth(), Value.isUnsigned());
>      NibbleMask = 0xf;
> -    for (int i = 0, e = Value.getActiveBits() / 4; i != e; ++i) {
> +    for (int i = 0, e = (Value.getActiveBits() + 3) / 4; i != e; ++i) {
>        *--CurPtr = 'A' + Temp.And(NibbleMask).getLimitedValue(0xf);
>        Temp = Temp.lshr(4);
>      }
>
> Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp?rev=165116&r1=165115&r2=165116&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp Wed Oct  3 08:39:49 2012
> @@ -54,6 +54,15 @@
>    IntTemplate<11> eleven;
>  // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0L@@@QAE at XZ"
>
> +  IntTemplate<256> _256;
> +// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0BAA@@@QAE at XZ"
> +
> +  IntTemplate<513> _513;
> +// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0CAB@@@QAE at XZ"
> +
> +  IntTemplate<1026> _1026;
> +// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0EAC@@@QAE at XZ"
> +
>    IntTemplate<65535> ffff;
>  // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0PPPP@@@QAE at XZ"
>  }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list