diff options
author | John McCall <rjmccall@apple.com> | 2011-05-01 22:35:37 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-05-01 22:35:37 +0000 |
commit | fb44de956f27875def889482b5393475060392af (patch) | |
tree | 8c683dafac4e76948ef44004fa6c63dec01c60a2 /test/CodeGenCXX/mangle-exprs.cpp | |
parent | 6857c3e12c86fd0271eb46baab5b18756a94f4cb (diff) |
Store a parameter index and function prototype depth in every
parameter node and use this to correctly mangle parameter
references in function template signatures.
A follow-up patch will improve the storage usage of these
fields; here I've just done the lazy thing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle-exprs.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-exprs.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-exprs.cpp b/test/CodeGenCXX/mangle-exprs.cpp index 5014a9145e..46c46f04a8 100644 --- a/test/CodeGenCXX/mangle-exprs.cpp +++ b/test/CodeGenCXX/mangle-exprs.cpp @@ -65,3 +65,47 @@ namespace test1 { b(s); } } + +namespace test2 { + template <class T> void a(T x, decltype(x()) y) {} + template <class T> auto b(T x) -> decltype(x()) { return x(); } + template <class T> void c(T x, void (*p)(decltype(x()))) {} + template <class T> void d(T x, auto (*p)() -> decltype(x())) {} + template <class T> void e(auto (*p)(T y) -> decltype(y())) {} + template <class T> void f(void (*p)(T x, decltype(x()) y)) {} + template <class T> void g(T x, decltype(x()) y) { + static decltype(x()) variable; + variable = 0; + } + template <class T> void h(T x, decltype((decltype(x())(*)()) 0) y) {} + template <class T> void i(decltype((auto (*)(T x) -> decltype(x())) 0) y) {} + + float foo(); + void bar(float); + float baz(float(*)()); + void fred(float(*)(), float); + + // CHECK: define void @_ZN5test211instantiateEv + void instantiate() { + // CHECK: call void @_ZN5test21aIPFfvEEEvT_DTclfL0p_EE( + a(foo, 0.0f); + // CHECK: call float @_ZN5test21bIPFfvEEEDTclfp_EET_( + (void) b(foo); + // CHECK: call void @_ZN5test21cIPFfvEEEvT_PFvDTclfL1p_EEE( + c(foo, bar); + // CHECK: call void @_ZN5test21dIPFfvEEEvT_PFDTclfL0p_EEvE( + d(foo, foo); + // CHECK: call void @_ZN5test21eIPFfvEEEvPFDTclfp_EET_E( + e(baz); + // CHECK: call void @_ZN5test21fIPFfvEEEvPFvT_DTclfL0p_EEE( + f(fred); + // CHECK: call void @_ZN5test21gIPFfvEEEvT_DTclfL0p_EE( + g(foo, 0.0f); + // CHECK: call void @_ZN5test21hIPFfvEEEvT_DTcvPFDTclfL0p_EEvELi0EE( + h(foo, foo); + // CHECK: call void @_ZN5test21iIPFfvEEEvDTcvPFDTclfp_EET_ELi0EE( + i<float(*)()>(baz); + } + + // CHECK: store float {{.*}}, float* @_ZZN5test21gIPFfvEEEvT_DTclfL0p_EEE8variable, +} |