[cfe-commits] [PATCH] [VCPP] Add __ptr64 qualifier
pravic
ehysta at gmail.com
Sun Nov 11 10:22:14 PST 2012
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);
+
+}
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101.4.patch
Type: text/x-patch
Size: 1844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121111/3d523cd4/attachment.bin>
More information about the cfe-commits
mailing list