diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-25 01:25:15 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-25 01:25:15 +0000 |
| commit | 5de91b58d0bd480d05d5cb7bbaa84ad7de38e2e6 (patch) | |
| tree | da9219b59918026d6e0032120ea15e327c36dc96 /clang/test/Modules | |
| parent | 0423b76be13eeca6663d278a636e1cb963da3091 (diff) | |
| download | bcm5719-llvm-5de91b58d0bd480d05d5cb7bbaa84ad7de38e2e6.tar.gz bcm5719-llvm-5de91b58d0bd480d05d5cb7bbaa84ad7de38e2e6.zip | |
Fix deserializing of class template partial specializations. Assign sequence
numbers as we deserialize class template partial specializations. We can't
assume that the old sequence numbers will work.
The sequence numbers are still deterministic, but are now a lot less
predictable for class template partial specializations in modules/PCH.
llvm-svn: 184811
Diffstat (limited to 'clang/test/Modules')
| -rw-r--r-- | clang/test/Modules/Inputs/cxx-templates-a.h | 6 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/cxx-templates-b.h | 6 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/cxx-templates-common.h | 1 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/module.map | 4 | ||||
| -rw-r--r-- | clang/test/Modules/cxx-templates.cpp | 31 |
5 files changed, 36 insertions, 12 deletions
diff --git a/clang/test/Modules/Inputs/cxx-templates-a.h b/clang/test/Modules/Inputs/cxx-templates-a.h index 76997c7bdbc..7770d345ed5 100644 --- a/clang/test/Modules/Inputs/cxx-templates-a.h +++ b/clang/test/Modules/Inputs/cxx-templates-a.h @@ -1,3 +1,5 @@ +@import cxx_templates_common; + template<typename T> T f() { return T(); } template<typename T> T f(T); namespace N { @@ -8,3 +10,7 @@ namespace N { template<int N> int template_param_kinds_1(); template<template<typename T, int, int> class> int template_param_kinds_2(); template<template<typename T, typename U, T> class> int template_param_kinds_3(); + +template<typename T> struct SomeTemplate<T*>; +template<typename T> struct SomeTemplate<T*> {}; +typedef SomeTemplate<int*> SomeTemplateIntPtr; diff --git a/clang/test/Modules/Inputs/cxx-templates-b.h b/clang/test/Modules/Inputs/cxx-templates-b.h index c50d7059b4b..e0f67d076c4 100644 --- a/clang/test/Modules/Inputs/cxx-templates-b.h +++ b/clang/test/Modules/Inputs/cxx-templates-b.h @@ -1,3 +1,5 @@ +@import cxx_templates_common; + template<typename T> T f(); template<typename T> T f(T t) { return t; } namespace N { @@ -8,3 +10,7 @@ namespace N { template<typename> int template_param_kinds_1(); template<template<typename, int, int...> class> int template_param_kinds_2(); template<template<typename T, typename U, U> class> int template_param_kinds_3(); + +template<typename T> struct SomeTemplate<T&> {}; +template<typename T> struct SomeTemplate<T&>; +typedef SomeTemplate<int&> SomeTemplateIntRef; diff --git a/clang/test/Modules/Inputs/cxx-templates-common.h b/clang/test/Modules/Inputs/cxx-templates-common.h new file mode 100644 index 00000000000..950a2a61e3d --- /dev/null +++ b/clang/test/Modules/Inputs/cxx-templates-common.h @@ -0,0 +1 @@ +template<typename T> struct SomeTemplate {}; diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map index d2ed75830b8..a4ac5b14de3 100644 --- a/clang/test/Modules/Inputs/module.map +++ b/clang/test/Modules/Inputs/module.map @@ -188,6 +188,10 @@ module cxx_linkage_cache { header "cxx-linkage-cache.h" } +module cxx_templates_common { + header "cxx-templates-common.h" +} + module cxx_templates_a { header "cxx-templates-a.h" } diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp index 7d500f4896c..84c93df5a37 100644 --- a/clang/test/Modules/cxx-templates.cpp +++ b/clang/test/Modules/cxx-templates.cpp @@ -17,37 +17,44 @@ void g() { f<double>(1.0); f<int>(); f(); // expected-error {{no matching function}} - // expected-note@Inputs/cxx-templates-b.h:1 {{couldn't infer template argument}} - // expected-note@Inputs/cxx-templates-b.h:2 {{requires single argument}} + // expected-note@Inputs/cxx-templates-b.h:3 {{couldn't infer template argument}} + // expected-note@Inputs/cxx-templates-b.h:4 {{requires single argument}} N::f(0); N::f<double>(1.0); N::f<int>(); N::f(); // expected-error {{no matching function}} - // expected-note@Inputs/cxx-templates-a.h:4 {{couldn't infer template argument}} - // expected-note@Inputs/cxx-templates-a.h:5 {{requires 1 argument, but 0 were provided}} + // expected-note@Inputs/cxx-templates-a.h:6 {{couldn't infer template argument}} + // expected-note@Inputs/cxx-templates-a.h:7 {{requires 1 argument, but 0 were provided}} template_param_kinds_1<0>(); // ok, from cxx-templates-a.h template_param_kinds_1<int>(); // ok, from cxx-templates-b.h template_param_kinds_2<Tmpl_T_C>(); // expected-error {{no matching function}} - // expected-note@Inputs/cxx-templates-a.h:9 {{invalid explicitly-specified argument}} - // expected-note@Inputs/cxx-templates-b.h:9 {{invalid explicitly-specified argument}} + // expected-note@Inputs/cxx-templates-a.h:11 {{invalid explicitly-specified argument}} + // expected-note@Inputs/cxx-templates-b.h:11 {{invalid explicitly-specified argument}} template_param_kinds_2<Tmpl_T_I_I>(); // expected-error {{ambiguous}} - // expected-note@Inputs/cxx-templates-a.h:9 {{candidate}} - // expected-note@Inputs/cxx-templates-b.h:9 {{candidate}} + // expected-note@Inputs/cxx-templates-a.h:11 {{candidate}} + // expected-note@Inputs/cxx-templates-b.h:11 {{candidate}} // FIXME: This should be valid, but we incorrectly match the template template // argument against both template template parameters. template_param_kinds_3<Tmpl_T_T_A>(); // expected-error {{ambiguous}} - // expected-note@Inputs/cxx-templates-a.h:10 {{candidate}} - // expected-note@Inputs/cxx-templates-b.h:10 {{candidate}} + // expected-note@Inputs/cxx-templates-a.h:12 {{candidate}} + // expected-note@Inputs/cxx-templates-b.h:12 {{candidate}} template_param_kinds_3<Tmpl_T_T_B>(); // expected-error {{ambiguous}} - // expected-note@Inputs/cxx-templates-a.h:10 {{candidate}} - // expected-note@Inputs/cxx-templates-b.h:10 {{candidate}} + // expected-note@Inputs/cxx-templates-a.h:12 {{candidate}} + // expected-note@Inputs/cxx-templates-b.h:12 {{candidate}} } +@import cxx_templates_common; + +typedef SomeTemplate<int*> SomeTemplateIntPtr; +typedef SomeTemplate<int&> SomeTemplateIntRef; +SomeTemplate<char*> some_template_char_ptr; +SomeTemplate<char&> some_template_char_ref; + // FIXME: There should only be two 'f's here. // CHECK-GLOBAL: DeclarationName 'f' // CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f' |

