Timur Iskhodzhanov | 3f7e9d2 | 2012-07-12 14:33:58 +0000 | [diff] [blame^] | 1 | // 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 | |
| 9 | namespace PR13207 { |
| 10 | class A {}; |
| 11 | class B {}; |
| 12 | class C {}; |
| 13 | |
| 14 | template<class X> |
| 15 | class F {}; |
| 16 | template<class X> |
| 17 | class I {}; |
| 18 | template<class X, class Y> |
| 19 | class J {}; |
| 20 | template<class X, class Y, class Z> |
| 21 | class K {}; |
| 22 | |
| 23 | class L { |
| 24 | public: |
| 25 | void foo(I<A> x) {} |
| 26 | }; |
| 27 | // CHECK: "\01?foo@L@PR13207@@QAEXV?$I@VA@PR13207@@@2@@Z" |
| 28 | |
| 29 | void call_l_foo(L* l) { l->foo(I<A>()); } |
| 30 | |
| 31 | void foo(I<A> x) {} |
| 32 | // CHECK: "\01?foo@PR13207@@YAXV?$I@VA@PR13207@@@1@@Z" |
| 33 | void foo2(I<A> x, I<A> y) { } |
| 34 | // CHECK "\01?foo2@PR13207@@YAXV?$I@VA@PR13207@@@1@0@Z" |
| 35 | void bar(J<A,B> x) {} |
| 36 | // CHECK: "\01?bar@PR13207@@YAXV?$J@VA@PR13207@@VB@2@@1@@Z" |
| 37 | void 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: |
| 45 | void 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" |
| 48 | void 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 | |
| 52 | namespace NA { |
| 53 | class X {}; |
| 54 | template<class T> class Y {}; |
| 55 | void foo(Y<X> x) {} |
| 56 | // CHECK: "\01?foo@NA@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z" |
| 57 | } |
| 58 | |
| 59 | namespace NB { |
| 60 | class X {}; |
| 61 | template<class T> class Y {}; |
| 62 | void foo(Y<NA::X> x) {} |
| 63 | // CHECK: "\01?foo@NB@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z" |
| 64 | |
| 65 | void bar(NA::Y<X> x) {} |
| 66 | // CHECK: "\01?bar@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@NA@2@@Z" |
| 67 | |
| 68 | void 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: |
| 72 | void 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 | |
| 76 | void 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 | |
| 80 | void 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 | |
| 84 | void 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 | |
| 89 | namespace NC { |
| 90 | class X {}; |
| 91 | template<class T> class Y {}; |
| 92 | |
| 93 | void foo(Y<NB::X> x) {} |
| 94 | // CHECK: "\01?foo@NC@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@@Z" |
| 95 | |
| 96 | void 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 | } |