From 8a35c7982c794ea7689e78845f1891f95202390d Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Tue, 22 Dec 2009 06:36:32 +0000 Subject: Make sure that we mangle overloaded operators that are member functions correctly, giving them the correct arity. With this seemingly insignificant fix, we are now able to build and link clang using clang itself! (LLVM still has to be built with gcc for the time being). llvm-svn: 91893 --- clang/test/CodeGenCXX/mangle.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'clang/test/CodeGenCXX/mangle.cpp') diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp index 090a3f17eef..88465cf9d98 100644 --- a/clang/test/CodeGenCXX/mangle.cpp +++ b/clang/test/CodeGenCXX/mangle.cpp @@ -141,7 +141,7 @@ int f(struct a *x) { // PR5017 extern "C" { struct Debug { - const Debug& operator<< (unsigned a) const { } + const Debug& operator<< (unsigned a) const { return *this; } }; Debug dbg; // CHECK: @_ZNK5DebuglsEj @@ -270,5 +270,23 @@ template void f4<1>(int (*)[4]); // CHECK: define void @_ZN11Expressions2f4ILb1EEEvPAquT_Li1ELi2E_i template void f4(int (*)[b ? 1 : 2]) { }; template void f4(int (*)[1]); - } + +struct Ops { + Ops& operator+(const Ops&); + Ops& operator-(const Ops&); + Ops& operator&(const Ops&); + Ops& operator*(const Ops&); + + void *v; +}; + +// CHECK: define %struct.Ops* @_ZN3OpsplERKS_ +Ops& Ops::operator+(const Ops&) { return *this; } +// CHECK: define %struct.Ops* @_ZN3OpsmiERKS_ +Ops& Ops::operator-(const Ops&) { return *this; } +// CHECK: define %struct.Ops* @_ZN3OpsanERKS_ +Ops& Ops::operator&(const Ops&) { return *this; } +// CHECK: define %struct.Ops* @_ZN3OpsmlERKS_ +Ops& Ops::operator*(const Ops&) { return *this; } + -- cgit v1.2.3