diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-16 01:40:34 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-16 01:40:34 +0000 |
commit | d6be277ba4bf271c6de8ffcc8c46f060c8cbd4d5 (patch) | |
tree | f9ab0a0466e03f7f692bbf76ccd2f73bcb4982fc /test/CodeGenCXX/mangle-windows.cpp | |
parent | 7a3dfcdfb32c08f2f6f4a90a097bb240fdc1a94c (diff) |
On 32 bit windows, mangle stdcall and fastcall decls in clang.
This removes the dependency on the llvm mangler doing it for us. In isolation,
the benefit is that the testing of what mangling is applied is all in one place:
(C, C++) X (Itanium, Microsoft) are all handled by clang.
This also gives me hope that in the future the llvm mangler (and llvm-ar) will
not depend on TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192762 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle-windows.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-windows.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-windows.cpp b/test/CodeGenCXX/mangle-windows.cpp new file mode 100644 index 0000000000..c087616875 --- /dev/null +++ b/test/CodeGenCXX/mangle-windows.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft \ +// RUN: -triple=i386-pc-win32 | FileCheck --check-prefix=WIN %s +// +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | \ +// RUN: FileCheck --check-prefix=ITANIUM %s + +void __stdcall f1(void) {} +// WIN: define x86_stdcallcc void @"\01?f1@@YGXXZ" +// ITANIUM: define x86_stdcallcc void @"\01__Z2f1v@0" + +void __fastcall f2(void) {} +// WIN: define x86_fastcallcc void @"\01?f2@@YIXXZ" +// ITANIUM: define x86_fastcallcc void @"\01@_Z2f2v@0" + +extern "C" void __stdcall f3(void) {} +// WIN: define x86_stdcallcc void @"\01_f3@0" +// ITANIUM: define x86_stdcallcc void @"\01_f3@0" + +extern "C" void __fastcall f4(void) {} +// WIN: define x86_fastcallcc void @"\01@f4@0" +// ITANIUM: define x86_fastcallcc void @"\01@f4@0" + +struct Foo { + void __stdcall foo(); + static void __stdcall bar(); +}; + +void Foo::foo() {} +// WIN: define x86_stdcallcc void @"\01?foo@Foo@@QAGXXZ" +// ITANIUM: define x86_stdcallcc void @"\01__ZN3Foo3fooEv@4" + +void Foo::bar() {} +// WIN: define x86_stdcallcc void @"\01?bar@Foo@@SGXXZ" +// ITANIUM: define x86_stdcallcc void @"\01__ZN3Foo3barEv@0" + +// Mostly a test that we don't crash and that the names start with a \01. +// gcc on mingw produces __Zpp@4 +// cl produces _++@4 +extern "C" void __stdcall operator++(Foo &x) { +} +// WIN: define x86_stdcallcc void @"\01??E@YGXAAUFoo@@@Z" +// ITANIUM: define x86_stdcallcc void @"\01__ZppR3Foo@4" |