aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-06-21 02:52:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-06-21 02:52:27 +0000
commit06e767d6703fdae9cda21c6c96c79a0135e2567a (patch)
treed3a7dbb8de666dacff4c7c9887cd7957a14ee003 /test
parentf96b9ce9d9bc8f11c7ec0ab856e592059c0f830a (diff)
MS: Mangle rvalue references and nullptr_t, and produce back-references when
appropriate. Patch by João Matos! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGenCXX/mangle-ms-back-references.cpp32
-rw-r--r--test/CodeGenCXX/mangle-ms-cxx11.cpp11
-rw-r--r--test/CodeGenCXX/mangle-ms.cpp9
3 files changed, 52 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-ms-back-references.cpp b/test/CodeGenCXX/mangle-ms-back-references.cpp
new file mode 100644
index 0000000000..fdfb3b5bf2
--- /dev/null
+++ b/test/CodeGenCXX/mangle-ms-back-references.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+
+void f1(const char* a, const char* b) {}
+// CHECK: "\01?f1@@YAXPBD0@Z"
+
+void f2(const char* a, char* b) {}
+// CHECK: "\01?f2@@YAXPBDPAD@Z"
+
+void f3(int a, const char* b, const char* c) {}
+// CHECK: "\01?f3@@YAXHPBD0@Z"
+
+const char *f4(const char* a, const char* b) {}
+// CHECK: "\01?f4@@YAPBDPBD0@Z"
+
+// FIXME: tests for more than 10 types?
+
+struct S {};
+
+void g4(const char* a, struct S* b, const char *c, struct S* d) {}
+// CHECK: "\01?g4@@YAXPBDPAUS@@01@Z"
+
+typedef void (*VoidFunc)();
+
+void foo_ptr(const char* a, const char* b, VoidFunc c, VoidFunc d) {}
+// CHECK: @"\01?foo_ptr@@YAXPBD0P6AXXZ1@Z"
+
+// Make sure that different aliases of built-in types end up mangled as the
+// built-ins.
+typedef unsigned int uintptr_t;
+typedef unsigned int size_t;
+void *h(size_t a, uintptr_t b) {}
+// CHECK: "\01?h@@YAPAXII@Z"
diff --git a/test/CodeGenCXX/mangle-ms-cxx11.cpp b/test/CodeGenCXX/mangle-ms-cxx11.cpp
new file mode 100644
index 0000000000..6947a53c4d
--- /dev/null
+++ b/test/CodeGenCXX/mangle-ms-cxx11.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+
+// CHECK: "\01?LRef@@YAXAAH@Z"
+void LRef(int& a) { }
+
+// CHECK: "\01?RRef@@YAH$$QAH@Z"
+int RRef(int&& a) { return a; }
+
+// CHECK: "\01?Null@@YAX$$T@Z"
+namespace std { typedef decltype(__nullptr) nullptr_t; }
+void Null(std::nullptr_t) {}
diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp
index cf4055f72a..326a848fcb 100644
--- a/test/CodeGenCXX/mangle-ms.cpp
+++ b/test/CodeGenCXX/mangle-ms.cpp
@@ -132,3 +132,12 @@ typedef double RGB[3];
RGB color1;
extern const RGB color2 = {};
extern RGB const ((color3)[5]) = {};
+
+// PR12603
+enum E {};
+// CHECK: "\01?fooE@@YA?AW4E@@XZ"
+E fooE() { return E(); }
+
+class X {};
+// CHECK: "\01?fooX@@YA?AVX@@XZ"
+X fooX() { return X(); }