190 lines · cpp
1// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s2 3void a1() {}4// CHECK: "?a1@@YAXXZ"5 6int a2() { return 0; }7// CHECK: "?a2@@YAHXZ"8 9const int a3() { return 0; }10// CHECK: "?a3@@YA?BHXZ"11 12volatile int a4() { return 0; }13// CHECK: "?a4@@YA?CHXZ"14 15const volatile int a5() { return 0; }16// CHECK: "?a5@@YA?DHXZ"17 18float a6() { return 0.0f; }19// CHECK: "?a6@@YAMXZ"20 21int *b1() { return 0; }22// CHECK: "?b1@@YAPAHXZ"23 24const char *b2() { return 0; }25// CHECK: "?b2@@YAPBDXZ"26 27float *b3() { return 0; }28// CHECK: "?b3@@YAPAMXZ"29 30const float *b4() { return 0; }31// CHECK: "?b4@@YAPBMXZ"32 33volatile float *b5() { return 0; }34// CHECK: "?b5@@YAPCMXZ"35 36const volatile float *b6() { return 0; }37// CHECK: "?b6@@YAPDMXZ"38 39float &b7() { return *(float*)0; }40// CHECK: "?b7@@YAAAMXZ"41 42const float &b8() { return *(float*)0; }43// CHECK: "?b8@@YAABMXZ"44 45volatile float &b9() { return *(float*)0; }46// CHECK: "?b9@@YAACMXZ"47 48const volatile float &b10() { return *(float*)0; }49// CHECK: "?b10@@YAADMXZ"50 51const char** b11() { return 0; }52// CHECK: "?b11@@YAPAPBDXZ"53 54class A {};55 56A c1() { return A(); }57// CHECK: "?c1@@YA?AVA@@XZ"58 59const A c2() { return A(); }60// CHECK: "?c2@@YA?BVA@@XZ"61 62volatile A c3() { return A(); }63// CHECK: "?c3@@YA?CVA@@XZ"64 65const volatile A c4() { return A(); }66// CHECK: "?c4@@YA?DVA@@XZ"67 68const A* c5() { return 0; }69// CHECK: "?c5@@YAPBVA@@XZ"70 71volatile A* c6() { return 0; }72// CHECK: "?c6@@YAPCVA@@XZ"73 74const volatile A* c7() { return 0; }75// CHECK: "?c7@@YAPDVA@@XZ"76 77A &c8() { return *(A*)0; }78// CHECK: "?c8@@YAAAVA@@XZ"79 80const A &c9() { return *(A*)0; }81// CHECK: "?c9@@YAABVA@@XZ"82 83volatile A &c10() { return *(A*)0; }84// CHECK: "?c10@@YAACVA@@XZ"85 86const volatile A &c11() { return *(A*)0; }87// CHECK: "?c11@@YAADVA@@XZ"88 89template<typename T> class B {};90 91B<int> d1() { return B<int>(); }92// CHECK: "?d1@@YA?AV?$B@H@@XZ"93 94B<const char*> d2() {return B<const char*>(); }95// CHECK: "?d2@@YA?AV?$B@PBD@@XZ"96 97B<A> d3() {return B<A>(); }98// CHECK: "?d3@@YA?AV?$B@VA@@@@XZ"99 100B<A>* d4() { return 0; }101// CHECK: "?d4@@YAPAV?$B@VA@@@@XZ"102 103const B<A>* d5() { return 0; }104// CHECK: "?d5@@YAPBV?$B@VA@@@@XZ"105 106volatile B<A>* d6() { return 0; }107// CHECK: "?d6@@YAPCV?$B@VA@@@@XZ"108 109const volatile B<A>* d7() { return 0; }110// CHECK: "?d7@@YAPDV?$B@VA@@@@XZ"111 112B<A>& d8() { return *(B<A>*)0; }113// CHECK: "?d8@@YAAAV?$B@VA@@@@XZ"114 115const B<A>& d9() { return *(B<A>*)0; }116// CHECK: "?d9@@YAABV?$B@VA@@@@XZ"117 118volatile B<A>& d10() { return *(B<A>*)0; }119// CHECK: "?d10@@YAACV?$B@VA@@@@XZ"120 121const volatile B<A>& d11() { return *(B<A>*)0; }122// CHECK: "?d11@@YAADV?$B@VA@@@@XZ"123 124enum Enum { DEFAULT };125 126Enum e1() { return DEFAULT; }127// CHECK: "?e1@@YA?AW4Enum@@XZ"128 129const Enum e2() { return DEFAULT; }130// CHECK: "?e2@@YA?BW4Enum@@XZ"131 132Enum* e3() { return 0; }133// CHECK: "?e3@@YAPAW4Enum@@XZ"134 135Enum& e4() { return *(Enum*)0; }136// CHECK: "?e4@@YAAAW4Enum@@XZ"137 138struct S {};139 140struct S f1() { struct S s; return s; }141// CHECK: "?f1@@YA?AUS@@XZ"142 143const struct S f2() { struct S s; return s; }144// CHECK: "?f2@@YA?BUS@@XZ"145 146struct S* f3() { return 0; }147// CHECK: "?f3@@YAPAUS@@XZ"148 149const struct S* f4() { return 0; }150// CHECK: "?f4@@YAPBUS@@XZ"151 152const volatile struct S* f5() { return 0; }153// CHECK: "?f5@@YAPDUS@@XZ"154 155struct S& f6() { return *(struct S*)0; }156// CHECK: "?f6@@YAAAUS@@XZ"157 158struct S* const f7() { return 0; }159// CHECK: "?f7@@YAQAUS@@XZ"160 161int S::* f8() { return 0; }162// CHECK: "?f8@@YAPQS@@HXZ"163 164int S::* const f9() { return 0; }165// CHECK: "?f9@@YAQQS@@HXZ"166 167int S::* __restrict f10() { return 0; }168// CHECK: "?f10@@YAPIQS@@HXZ"169 170int S::* const __restrict f11() { return 0; }171// CHECK: "?f11@@YAQIQS@@HXZ"172 173typedef int (*function_pointer)(int);174 175function_pointer g1() { return 0; }176// CHECK: "?g1@@YAP6AHH@ZXZ"177 178const function_pointer g2() { return 0; }179// CHECK: "?g2@@YAQ6AHH@ZXZ"180 181function_pointer* g3() { return 0; }182// CHECK: "?g3@@YAPAP6AHH@ZXZ"183 184const function_pointer* g4() { return 0; }185// CHECK: "?g4@@YAPBQ6AHH@ZXZ"186 187extern int &z;188int & __restrict h1() { return z; }189// CHECK: "?h1@@YAAIAHXZ"190