blob: 95ac5bb9212fb63e36fdeede1564ac4ed79e1dd1 [file] [log] [blame]
Richard Smith06e767d2012-06-21 02:52:27 +00001// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
2
3void f1(const char* a, const char* b) {}
4// CHECK: "\01?f1@@YAXPBD0@Z"
5
6void f2(const char* a, char* b) {}
7// CHECK: "\01?f2@@YAXPBDPAD@Z"
8
9void f3(int a, const char* b, const char* c) {}
10// CHECK: "\01?f3@@YAXHPBD0@Z"
11
12const char *f4(const char* a, const char* b) {}
13// CHECK: "\01?f4@@YAPBDPBD0@Z"
14
Timur Iskhodzhanov3f835682012-06-23 00:54:17 +000015void f5(char const* a, unsigned int b, char c, void const* d, char const* e, unsigned int f) {}
16// CHECK: "\01?f5@@YAXPBDIDPBX0I@Z"
17
18void f6(bool a, bool b) {}
19// CHECK: "\01?f6@@YAX_N0@Z"
20
21void f7(int a, int* b, int c, int* d, bool e, bool f, bool* g) {}
22// CHECK: "\01?f7@@YAXHPAHH0_N1PA_N@Z"
23
Richard Smith06e767d2012-06-21 02:52:27 +000024// FIXME: tests for more than 10 types?
25
Timur Iskhodzhanov3f835682012-06-23 00:54:17 +000026struct S {
27 void mbb(bool a, bool b) {}
28};
Richard Smith06e767d2012-06-21 02:52:27 +000029
Timur Iskhodzhanov3f835682012-06-23 00:54:17 +000030void g1(struct S a) {}
31// CHECK: "\01?g1@@YAXUS@@@Z"
32
33void g2(struct S a, struct S b) {}
34// CHECK: "\01?g2@@YAXUS@@0@Z"
35
36void g3(struct S a, struct S b, struct S* c, struct S* d) {}
37// CHECK: "\01?g3@@YAXUS@@0PAU1@1@Z"
38
39void g4(const char* a, struct S* b, const char* c, struct S* d) {
Richard Smith06e767d2012-06-21 02:52:27 +000040// CHECK: "\01?g4@@YAXPBDPAUS@@01@Z"
Timur Iskhodzhanov3f835682012-06-23 00:54:17 +000041 b->mbb(false, false);
42// CHECK: "\01?mbb@S@@QAEX_N0@Z"
43}
Richard Smith06e767d2012-06-21 02:52:27 +000044
45// Make sure that different aliases of built-in types end up mangled as the
46// built-ins.
47typedef unsigned int uintptr_t;
48typedef unsigned int size_t;
49void *h(size_t a, uintptr_t b) {}
50// CHECK: "\01?h@@YAPAXII@Z"
Timur Iskhodzhanov3f835682012-06-23 00:54:17 +000051
52// Function pointers might be mangled in a complex way.
53typedef void (*VoidFunc)();
54typedef int* (*PInt3Func)(int* a, int* b);
55
56void h1(const char* a, const char* b, VoidFunc c, VoidFunc d) {}
57// CHECK: "\01?h1@@YAXPBD0P6AXXZ1@Z"
58
59void h2(void (*f_ptr)(void *), void *arg) {}
60// CHECK: "\01?h2@@YAXP6AXPAX@Z0@Z"
61
62PInt3Func h3(PInt3Func x, PInt3Func y, int* z) { return 0; }
63// CHECK: "\01?h3@@YAP6APAHPAH0@ZP6APAH00@Z10@Z"