From 96d51cc69a0471bc992753e1ce44390a1d6ea177 Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Wed, 7 Oct 2020 11:52:00 +0200 Subject: [PATCH] Add tests testing more complicated template scenarios for #32950. Specifically: * class template with variadic parameter * class template with non-type parameter * class template with template template parameter --- .../class-template-non-type-parameter.h | 11 +++++++ .../class-template-template-parameter.h | 23 ++++++++++++++ .../Inputs/class-template-variadic.h | 30 +++++++++++++++++++ .../Cxx/templates/Inputs/module.modulemap | 12 ++++++++ .../class-template-non-type-parameter.swift | 15 ++++++++++ .../class-template-template-parameter.swift | 17 +++++++++++ .../templates/class-template-variadic.swift | 27 +++++++++++++++++ test/Interop/Cxx/templates/demangling.swift | 12 ++++++++ 8 files changed, 147 insertions(+) create mode 100644 test/Interop/Cxx/templates/Inputs/class-template-non-type-parameter.h create mode 100644 test/Interop/Cxx/templates/Inputs/class-template-template-parameter.h create mode 100644 test/Interop/Cxx/templates/Inputs/class-template-variadic.h create mode 100644 test/Interop/Cxx/templates/class-template-non-type-parameter.swift create mode 100644 test/Interop/Cxx/templates/class-template-template-parameter.swift create mode 100644 test/Interop/Cxx/templates/class-template-variadic.swift create mode 100644 test/Interop/Cxx/templates/demangling.swift diff --git a/test/Interop/Cxx/templates/Inputs/class-template-non-type-parameter.h b/test/Interop/Cxx/templates/Inputs/class-template-non-type-parameter.h new file mode 100644 index 0000000000000..1727b1849fcba --- /dev/null +++ b/test/Interop/Cxx/templates/Inputs/class-template-non-type-parameter.h @@ -0,0 +1,11 @@ +#ifndef TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_NON_TYPE_PARAMETER_H +#define TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_NON_TYPE_PARAMETER_H + +template +struct MagicArray { + T t[Size]; +}; + +typedef MagicArray MagicIntPair; + +#endif // TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_NON_TYPE_PARAMETER_H diff --git a/test/Interop/Cxx/templates/Inputs/class-template-template-parameter.h b/test/Interop/Cxx/templates/Inputs/class-template-template-parameter.h new file mode 100644 index 0000000000000..913c30ddaa92c --- /dev/null +++ b/test/Interop/Cxx/templates/Inputs/class-template-template-parameter.h @@ -0,0 +1,23 @@ +#ifndef TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_TEMPLATE_PARAMETER_H +#define TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_TEMPLATE_PARAMETER_H + +struct IntWrapper { + int value; + int getValue() const { return value; } +}; + +template +struct MagicWrapper { + T t; + int getValuePlusArg(int arg) const { return t.getValue() + arg; } +}; + +template