From f9aed96537a23c9e8852a8ba6429feb25a23dbc9 Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Thu, 12 Jul 2012 14:33:58 +0000 Subject: [PATCH] [Windows] Split the back reference tests into two separate files as the templates are getting hairy git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160131 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../mangle-ms-back-references-pr13207.cpp | 99 +++++++++++++++++++ test/CodeGenCXX/mangle-ms-back-references.cpp | 98 ------------------ 2 files changed, 99 insertions(+), 98 deletions(-) create mode 100644 test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp diff --git a/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp b/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp new file mode 100644 index 0000000000..b5e1a0dc2d --- /dev/null +++ b/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp @@ -0,0 +1,99 @@ +// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s + +// NOTE on the "CURRENT" prefix: some things are mangled incorrectly as of +// writing. If you find a CURRENT-test that fails with your patch, please test +// if your patch has actually fixed a problem in the mangler and replace the +// corresponding CORRECT line with a CHECK. +// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck -check-prefix CURRENT %s + +namespace PR13207 { +class A {}; +class B {}; +class C {}; + +template +class F {}; +template +class I {}; +template +class J {}; +template +class K {}; + +class L { + public: + void foo(I x) {} +}; +// CHECK: "\01?foo@L@PR13207@@QAEXV?$I@VA@PR13207@@@2@@Z" + +void call_l_foo(L* l) { l->foo(I()); } + +void foo(I x) {} +// CHECK: "\01?foo@PR13207@@YAXV?$I@VA@PR13207@@@1@@Z" +void foo2(I x, I y) { } +// CHECK "\01?foo2@PR13207@@YAXV?$I@VA@PR13207@@@1@0@Z" +void bar(J x) {} +// CHECK: "\01?bar@PR13207@@YAXV?$J@VA@PR13207@@VB@2@@1@@Z" +void spam(K x) {} +// CHECK: "\01?spam@PR13207@@YAXV?$K@VA@PR13207@@VB@2@VC@2@@1@@Z" + +// The following CURRENT line is here to improve the precision of the "scanning +// from here" reports of FileCheck. +// CURRENT: "\01?spam@PR13207@@YAXV?$K@VA@PR13207@@VB@2@VC@2@@1@@Z" + +// The tests below currently fail: +void baz(K, I >) {} +// CURRENT: "\01?baz@PR13207@@YAXV?$K@DV?$F@D@PR13207@@V?$I@D@1@@1@@Z" +// CORRECT: "\01?baz@PR13207@@YAXV?$K@DV?$F@D@PR13207@@V?$I@D@2@@1@@Z" +void qux(K, I >) {} +// CURRENT: "\01?qux@PR13207@@YAXV?$K@DV?$I@D@PR13207@@V?$I@D@1@@1@@Z" +// CORRECT: "\01?qux@PR13207@@YAXV?$K@DV?$I@D@PR13207@@V12@@1@@Z + +namespace NA { +class X {}; +template class Y {}; +void foo(Y x) {} +// CHECK: "\01?foo@NA@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z" +} + +namespace NB { +class X {}; +template class Y {}; +void foo(Y x) {} +// CHECK: "\01?foo@NB@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z" + +void bar(NA::Y x) {} +// CHECK: "\01?bar@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@NA@2@@Z" + +void spam(NA::Y x) {} +// CHECK: "\01?spam@NB@PR13207@@YAXV?$Y@VX@NA@PR13207@@@NA@2@@Z" + +// The tests below currently fail: +void foobar(NA::Y > a, Y >) {} +// 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" +// CORRECT: "\01?foobar@NB@PR13207@@YAXV?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V312@@Z" + +void foobarspam(Y a, NA::Y > b, Y >) {} +// 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" +// CORRECT: "\01?foobarspam@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V412@@Z" + +void foobarbaz(Y a, NA::Y > b, Y >, Y > c) {} +// 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" +// 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" + +void foobarbazqux(Y a, NA::Y > b, Y >, Y > c , NA::Y > > d) {} +// 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" +// 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" +} + +namespace NC { +class X {}; +template class Y {}; + +void foo(Y x) {} +// CHECK: "\01?foo@NC@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@@Z" + +void foobar(NC::Y > > x) {} +// CHECK: "\01?foobar@NC@PR13207@@YAXV?$Y@V?$Y@V?$Y@VX@NA@PR13207@@@NA@PR13207@@@NB@PR13207@@@12@@Z" +} +} diff --git a/test/CodeGenCXX/mangle-ms-back-references.cpp b/test/CodeGenCXX/mangle-ms-back-references.cpp index 33a442259c..5f93590cf2 100644 --- a/test/CodeGenCXX/mangle-ms-back-references.cpp +++ b/test/CodeGenCXX/mangle-ms-back-references.cpp @@ -1,11 +1,5 @@ // RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s -// NOTE on the "CURRENT" prefix: some things are mangled incorrectly as of -// writing. If you find a CURRENT-test that fails with your patch, please test -// if your patch has actually fixed a problem in the mangler and replace the -// corresponding CORRECT line with a CHECK. -// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck -check-prefix CURRENT %s - void f1(const char* a, const char* b) {} // CHECK: "\01?f1@@YAXPBD0@Z" @@ -67,95 +61,3 @@ void h2(void (*f_ptr)(void *), void *arg) {} PInt3Func h3(PInt3Func x, PInt3Func y, int* z) { return 0; } // CHECK: "\01?h3@@YAP6APAHPAH0@ZP6APAH00@Z10@Z" - -namespace PR13207 { -class A {}; -class B {}; -class C {}; - -template -class F {}; -template -class I {}; -template -class J {}; -template -class K {}; - -class L { - public: - void foo(I x) {} -}; -// CHECK: "\01?foo@L@PR13207@@QAEXV?$I@VA@PR13207@@@2@@Z" - -void call_l_foo(L* l) { l->foo(I()); } - -void foo(I x) {} -// CHECK: "\01?foo@PR13207@@YAXV?$I@VA@PR13207@@@1@@Z" -void foo2(I x, I y) { } -// CHECK "\01?foo2@PR13207@@YAXV?$I@VA@PR13207@@@1@0@Z" -void bar(J x) {} -// CHECK: "\01?bar@PR13207@@YAXV?$J@VA@PR13207@@VB@2@@1@@Z" -void spam(K x) {} -// CHECK: "\01?spam@PR13207@@YAXV?$K@VA@PR13207@@VB@2@VC@2@@1@@Z" - -// The following CURRENT line is here to improve the precision of the "scanning -// from here" reports of FileCheck. -// CURRENT: "\01?spam@PR13207@@YAXV?$K@VA@PR13207@@VB@2@VC@2@@1@@Z" - -// The tests below currently fail: -void baz(K, I >) {} -// CURRENT: "\01?baz@PR13207@@YAXV?$K@DV?$F@D@PR13207@@V?$I@D@1@@1@@Z" -// CORRECT: "\01?baz@PR13207@@YAXV?$K@DV?$F@D@PR13207@@V?$I@D@2@@1@@Z" -void qux(K, I >) {} -// CURRENT: "\01?qux@PR13207@@YAXV?$K@DV?$I@D@PR13207@@V?$I@D@1@@1@@Z" -// CORRECT: "\01?qux@PR13207@@YAXV?$K@DV?$I@D@PR13207@@V12@@1@@Z - -namespace NA { -class X {}; -template class Y {}; -void foo(Y x) {} -// CHECK: "\01?foo@NA@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z" -} - -namespace NB { -class X {}; -template class Y {}; -void foo(Y x) {} -// CHECK: "\01?foo@NB@PR13207@@YAXV?$Y@VX@NA@PR13207@@@12@@Z" - -void bar(NA::Y x) {} -// CHECK: "\01?bar@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@NA@2@@Z" - -void spam(NA::Y x) {} -// CHECK: "\01?spam@NB@PR13207@@YAXV?$Y@VX@NA@PR13207@@@NA@2@@Z" - -// The tests below currently fail: -void foobar(NA::Y > a, Y >) {} -// 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" -// CORRECT: "\01?foobar@NB@PR13207@@YAXV?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V312@@Z" - -void foobarspam(Y a, NA::Y > b, Y >) {} -// 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" -// CORRECT: "\01?foobarspam@NB@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@V?$Y@V?$Y@VX@NB@PR13207@@@NB@PR13207@@@NA@2@V412@@Z" - -void foobarbaz(Y a, NA::Y > b, Y >, Y > c) {} -// 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" -// 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" - -void foobarbazqux(Y a, NA::Y > b, Y >, Y > c , NA::Y > > d) {} -// 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" -// 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" -} - -namespace NC { -class X {}; -template class Y {}; - -void foo(Y x) {} -// CHECK: "\01?foo@NC@PR13207@@YAXV?$Y@VX@NB@PR13207@@@12@@Z" - -void foobar(NC::Y > > x) {} -// CHECK: "\01?foobar@NC@PR13207@@YAXV?$Y@V?$Y@V?$Y@VX@NA@PR13207@@@NA@PR13207@@@NB@PR13207@@@12@@Z" -} -} -- 2.50.1