1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
2f4a2713aSLionel Sambuc
f1(const char * a,const char * b)3f4a2713aSLionel Sambuc void f1(const char* a, const char* b) {}
4f4a2713aSLionel Sambuc // CHECK: "\01?f1@@YAXPBD0@Z"
5f4a2713aSLionel Sambuc
f2(const char * a,char * b)6f4a2713aSLionel Sambuc void f2(const char* a, char* b) {}
7f4a2713aSLionel Sambuc // CHECK: "\01?f2@@YAXPBDPAD@Z"
8f4a2713aSLionel Sambuc
f3(int a,const char * b,const char * c)9f4a2713aSLionel Sambuc void f3(int a, const char* b, const char* c) {}
10f4a2713aSLionel Sambuc // CHECK: "\01?f3@@YAXHPBD0@Z"
11f4a2713aSLionel Sambuc
f4(const char * a,const char * b)12f4a2713aSLionel Sambuc const char *f4(const char* a, const char* b) { return 0; }
13f4a2713aSLionel Sambuc // CHECK: "\01?f4@@YAPBDPBD0@Z"
14f4a2713aSLionel Sambuc
f5(char const * a,unsigned int b,char c,void const * d,char const * e,unsigned int f)15f4a2713aSLionel Sambuc void f5(char const* a, unsigned int b, char c, void const* d, char const* e, unsigned int f) {}
16f4a2713aSLionel Sambuc // CHECK: "\01?f5@@YAXPBDIDPBX0I@Z"
17f4a2713aSLionel Sambuc
f6(bool a,bool b)18f4a2713aSLionel Sambuc void f6(bool a, bool b) {}
19f4a2713aSLionel Sambuc // CHECK: "\01?f6@@YAX_N0@Z"
20f4a2713aSLionel Sambuc
f7(int a,int * b,int c,int * d,bool e,bool f,bool * g)21f4a2713aSLionel Sambuc void f7(int a, int* b, int c, int* d, bool e, bool f, bool* g) {}
22f4a2713aSLionel Sambuc // CHECK: "\01?f7@@YAXHPAHH0_N1PA_N@Z"
23f4a2713aSLionel Sambuc
24f4a2713aSLionel Sambuc // FIXME: tests for more than 10 types?
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambuc struct S {
mbbS27f4a2713aSLionel Sambuc void mbb(bool a, bool b) {}
28f4a2713aSLionel Sambuc };
29f4a2713aSLionel Sambuc
g1(struct S a)30f4a2713aSLionel Sambuc void g1(struct S a) {}
31f4a2713aSLionel Sambuc // CHECK: "\01?g1@@YAXUS@@@Z"
32f4a2713aSLionel Sambuc
g2(struct S a,struct S b)33f4a2713aSLionel Sambuc void g2(struct S a, struct S b) {}
34f4a2713aSLionel Sambuc // CHECK: "\01?g2@@YAXUS@@0@Z"
35f4a2713aSLionel Sambuc
g3(struct S a,struct S b,struct S * c,struct S * d)36f4a2713aSLionel Sambuc void g3(struct S a, struct S b, struct S* c, struct S* d) {}
37f4a2713aSLionel Sambuc // CHECK: "\01?g3@@YAXUS@@0PAU1@1@Z"
38f4a2713aSLionel Sambuc
g4(const char * a,struct S * b,const char * c,struct S * d)39f4a2713aSLionel Sambuc void g4(const char* a, struct S* b, const char* c, struct S* d) {
40f4a2713aSLionel Sambuc // CHECK: "\01?g4@@YAXPBDPAUS@@01@Z"
41f4a2713aSLionel Sambuc b->mbb(false, false);
42f4a2713aSLionel Sambuc // CHECK: "\01?mbb@S@@QAEX_N0@Z"
43f4a2713aSLionel Sambuc }
44f4a2713aSLionel Sambuc
45f4a2713aSLionel Sambuc // Make sure that different aliases of built-in types end up mangled as the
46f4a2713aSLionel Sambuc // built-ins.
47f4a2713aSLionel Sambuc typedef unsigned int uintptr_t;
48f4a2713aSLionel Sambuc typedef unsigned int size_t;
h(size_t a,uintptr_t b)49f4a2713aSLionel Sambuc void *h(size_t a, uintptr_t b) { return 0; }
50f4a2713aSLionel Sambuc // CHECK: "\01?h@@YAPAXII@Z"
51f4a2713aSLionel Sambuc
52f4a2713aSLionel Sambuc // Function pointers might be mangled in a complex way.
53f4a2713aSLionel Sambuc typedef void (*VoidFunc)();
54f4a2713aSLionel Sambuc typedef int* (*PInt3Func)(int* a, int* b);
55f4a2713aSLionel Sambuc
h1(const char * a,const char * b,VoidFunc c,VoidFunc d)56f4a2713aSLionel Sambuc void h1(const char* a, const char* b, VoidFunc c, VoidFunc d) {}
57f4a2713aSLionel Sambuc // CHECK: "\01?h1@@YAXPBD0P6AXXZ1@Z"
58f4a2713aSLionel Sambuc
h2(void (* f_ptr)(void *),void * arg)59f4a2713aSLionel Sambuc void h2(void (*f_ptr)(void *), void *arg) {}
60f4a2713aSLionel Sambuc // CHECK: "\01?h2@@YAXP6AXPAX@Z0@Z"
61f4a2713aSLionel Sambuc
h3(PInt3Func x,PInt3Func y,int * z)62f4a2713aSLionel Sambuc PInt3Func h3(PInt3Func x, PInt3Func y, int* z) { return 0; }
63f4a2713aSLionel Sambuc // CHECK: "\01?h3@@YAP6APAHPAH0@ZP6APAH00@Z10@Z"
64f4a2713aSLionel Sambuc
65f4a2713aSLionel Sambuc namespace foo {
foo()66f4a2713aSLionel Sambuc void foo() { }
67f4a2713aSLionel Sambuc // CHECK: "\01?foo@0@YAXXZ"
68f4a2713aSLionel Sambuc }
69