[cfe-commits] [PATCH] [VCPP] Add __ptr64 qualifier
Aaron Ballman
aaron at aaronballman.com
Sun Nov 11 13:40:49 PST 2012
Thanks for fixing up the line endings!
I'm still not convinced that this is working as intended. Your code
is only handling C++ functions that are public, but there are a lot
more cases you're not testing against.
Also, the code doesn't match what's described in the comment in
mangleFunctionClass (E is already handled for virtual near).
Here's a really simple example I threw together:
class cls {
void priv( int * p) {}
public:
void pub( int * p) { priv( p ); }
};
?priv at cls@@AEAAXPEAH at Z // MSVC 11
?priv at cls@@AAAXPAH at Z // With the patch
?priv at cls@@AAAXPAH at Z // Without the patch
?pub at cls@@QEAAXPEAH at Z // MSVC 11
?pub at cls@@QEAAXPAH at Z // With the patch
?pub at cls@@QAAXPAH at Z // Without the patch
I think that more test cases are required to ensure the patch is
actually hitting all of the required areas. But we're moving in the
right direction, so don't be discouraged!
~Aaron
On Sun, Nov 11, 2012 at 1:22 PM, pravic <ehysta at gmail.com> wrote:
> Changed line endings.
>
> Explicit __ptr64 variables qualifier is not supported, ofc.
>
> Hi cdavis5x,
>
> http://llvm-reviews.chandlerc.com/D101
>
> CHANGE SINCE LAST DIFF
> http://llvm-reviews.chandlerc.com/D101?vs=271&id=292#toc
>
> Files:
> lib/AST/MicrosoftMangle.cpp
> test/CodeGenCXX/mangle-ms-ptr64.cpp
>
> Index: lib/AST/MicrosoftMangle.cpp
> ===================================================================
> --- lib/AST/MicrosoftMangle.cpp
> +++ lib/AST/MicrosoftMangle.cpp
> @@ -1218,6 +1218,10 @@
> Out << 'U';
> else
> Out << 'Q';
> +
> + // mangle function with __ptr64 qualifier on x64 mode.
> + if (getASTContext().getTargetInfo().getPointerWidth(0) == 64)
> + Out << 'E';
> }
> } else
> Out << 'Y';
> Index: test/CodeGenCXX/mangle-ms-ptr64.cpp
> ===================================================================
> --- /dev/null
> +++ test/CodeGenCXX/mangle-ms-ptr64.cpp
> @@ -0,0 +1,43 @@
> +// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -fms-extensions -triple=i386-pc-win32 | FileCheck %s
> +// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -fms-extensions -triple=x86_64-pc-win32 | FileCheck -check-prefix=CHK64 %s
> +// expected-no-diagnostics
> +
> +// pointer qualifications mangling
> +
> +// CHECK: @"\01?VS_p32@@3PAHA" = global i32* null
> +// CHK64: @"\01?VS_p32@@3PAHA" = global i32* null
> +int * __ptr32 VS_p32;
> +
> +// @"\01?VS_p64@@3PEAHEA" = global i32* null
> +// @"\01?VS_p64@@3PEAHEA" = global i32* null
> +int * __ptr64 VS_p64;
> +
> +
> +// Struct mangling
> +template<class T>
> +struct VS_1 { VS_1(T); };
> +
> +struct VS_0 {
> + VS_0( );
> +
> + virtual int check();
> +};
> +
> +void test_vs() {
> + // 'QAE': __thiscall (x86)
> + // 'QAA': __cdecl (x86)
> + // 'QEAA': __cdecl __ptr64 (x64)
> + // CHECK: @"\01??0VS_0@@QAE at XZ"(%struct.VS_0* %vs0)
> + // CHK64: @"\01??0VS_0@@QEAA at XZ"(%struct.VS_0* %vs0)
> + VS_0 vs0;
> +
> + // CHECK: @"\01?check at VS_0@@UAEHXZ"(%struct.VS_0* %vs0)
> + // CHK64: @"\01?check at VS_0@@UEAAHXZ"(%struct.VS_0* %vs0)
> + vs0.check();
> +
> + // CHECK: @"\01??0?$VS_1 at H@@QAE at H@Z"(%struct.VS_1* %vs1, i32 1)
> + // CHK64: @"\01??0?$VS_1 at H@@QEAA at H@Z"(%struct.VS_1* %vs1, i32 1)
> + VS_1<int> vs1(1);
> +
> +}
> +
>
> _______________________________________________
> 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