blob: b5e1a0dc2d84b25cc2855e77acbed8bb2a3d64a9 [file] [log] [blame]
Timur Iskhodzhanov3f7e9d22012-07-12 14:33:58 +00001// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
2
3// NOTE on the "CURRENT" prefix: some things are mangled incorrectly as of
4// writing. If you find a CURRENT-test that fails with your patch, please test
5// if your patch has actually fixed a problem in the mangler and replace the
6// corresponding CORRECT line with a CHECK.
7// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck -check-prefix CURRENT %s
8
9namespace PR13207 {
10class A {};
11class B {};
12class C {};
13
14template<class X>
15class F {};
16template<class X>
17class I {};
18template<class X, class Y>
19class J {};
20template<class X, class Y, class Z>
21class K {};
22
23class L {
24 public:
25 void foo(I<A> x) {}
26};
27// CHECK: "\01?foo@L@PR13207@@QAEXV?$I@VA@PR13207@@@2@@Z"
28
29void call_l_foo(L* l) { l->foo(I<A>()); }
30
31void foo(I<A> x) {}
32// CHECK: "\01?foo@PR13207@@YAXV?$I@VA@PR13207@@@1@@Z"
33void foo2(I<A> x, I<A> y) { }
34// CHECK "\01?foo2@PR13207@@YAXV?$I@VA@PR13207@@@1@0@Z"
35void bar(J<A,B> x) {}
36// CHECK: "\01?bar@PR13207@@YAXV?$J@VA@PR13207@@VB@2@@1@@Z"
37void spam(K<A,B,C> x) {}
38// CHECK: "\01?spam@PR13207@@YAXV?$K@VA@PR13207@@VB@2@VC@2@@1@@Z"
39
40// The following CURRENT line is here to improve the precision of the "scanning
41// from here" reports of FileCheck.
42// CURRENT: "\01?spam@PR13207@@YAXV?$K@VA@PR13207@@VB@2@VC@2@@1@@Z"
43
44// The tests below currently fail:
45void baz(K<char, F<char>, I<char> >) {}
46// CURRENT: "\01?baz@PR13207@@YAXV?$K@DV?$F@D@PR13207@@V?$I@D@1@@1@@Z"
47// CORRECT: "\01?baz@PR13207@@YAXV?$K@DV?$F@D@PR13207@@V?$I@D@2@@1@@Z"
48void qux(K<char, I<char>, I<char> >) {}
49// CURRENT: "\01?qux@PR13207@@YAXV?$K@DV?$I@D@PR13207@@V?$I@D@1@@1@@Z"
50// CORRECT: "\01?qux@PR13207@@YAXV?$K@DV?$I@D@PR13207@@V12@@1@@Z
51
52namespace NA {
53class X {};
54template<class T> class Y {};
55void foo(Y<X> x) {}
56// CHECK: "\01?foo@NA@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z"
57}
58
59namespace NB {
60class X {};
61template<class T> class Y {};
62void foo(Y<NA::X> x) {}
63// CHECK: "\01?foo@NB@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z"
64
65void bar(NA::Y<X> x) {}
66// CHECK: "\01?bar@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@NA@2@@Z"
67
68void spam(NA::Y<NA::X> x) {}
69// CHECK: "\01?spam@NB@PR13207@@YAXV?$Y@VX@NA@PR13207@@@NA@2@@Z"
70
71// The tests below currently fail:
72void foobar(NA::Y<Y<X> > a, Y<Y<X> >) {}
73// CURRENT: "\01?foobar@NB@PR13207@@YAXV?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@12@@Z"
74// CORRECT: "\01?foobar@NB@PR13207@@YAXV?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V312@@Z"
75
76void foobarspam(Y<X> a, NA::Y<Y<X> > b, Y<Y<X> >) {}
77// CURRENT: "\01?foobarspam@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@12@@Z"
78// CORRECT: "\01?foobarspam@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V412@@Z"
79
80void foobarbaz(Y<X> a, NA::Y<Y<X> > b, Y<Y<X> >, Y<Y<X> > c) {}
81// CURRENT: "\01?foobarbaz@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@12@2@Z"
82// CORRECT: "\01?foobarbaz@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V412@2@Z"
83
84void foobarbazqux(Y<X> a, NA::Y<Y<X> > b, Y<Y<X> >, Y<Y<X> > c , NA::Y<Y<Y<X> > > d) {}
85// CURRENT: "\01?foobarbazqux@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@12@2V?$Y@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NB@PR13207@@@32@@Z"
86// CORRECT: "\01?foobarbazqux@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V412@2V?$Y@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NB@PR13207@@@52@@Z"
87}
88
89namespace NC {
90class X {};
91template<class T> class Y {};
92
93void foo(Y<NB::X> x) {}
94// CHECK: "\01?foo@NC@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@@Z"
95
96void foobar(NC::Y<NB::Y<NA::Y<NA::X> > > x) {}
97// CHECK: "\01?foobar@NC@PR13207@@YAXV?$Y@V?$Y@V?$Y@VX@NA@PR13207@@@NA@PR13207@@@NB@PR13207@@@12@@Z"
98}
99}