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@XZ"(%struct.VS_0* %vs0)
+       // CHK64: @"\01??0VS_0@@QEAA@XZ"(%struct.VS_0* %vs0)
+       VS_0 vs0;
+       
+       // CHECK: @"\01?check@VS_0@@UAEHXZ"(%struct.VS_0* %vs0)
+       // CHK64: @"\01?check@VS_0@@UEAAHXZ"(%struct.VS_0* %vs0)
+       vs0.check();
+       
+       // CHECK: @"\01??0?$VS_1@H@@QAE@H@Z"(%struct.VS_1* %vs1, i32 1)
+       // CHK64: @"\01??0?$VS_1@H@@QEAA@H@Z"(%struct.VS_1* %vs1, i32 1)
+       VS_1<int> vs1(1);
+       
+}
+
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@XZ"(%struct.VS_0* %vs0)
+	// CHK64: @"\01??0VS_0@@QEAA@XZ"(%struct.VS_0* %vs0)
+	VS_0 vs0;
+	
+	// CHECK: @"\01?check@VS_0@@UAEHXZ"(%struct.VS_0* %vs0)
+	// CHK64: @"\01?check@VS_0@@UEAAHXZ"(%struct.VS_0* %vs0)
+	vs0.check();
+	
+	// CHECK: @"\01??0?$VS_1@H@@QAE@H@Z"(%struct.VS_1* %vs1, i32 1)
+	// CHK64: @"\01??0?$VS_1@H@@QEAA@H@Z"(%struct.VS_1* %vs1, i32 1)
+	VS_1<int> vs1(1);
+	
+}
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to