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