mangle-ms-abi-examples.cpp revision 651f13cea278ec967336033dd032faef0e9fc2ec
1651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// RUN: %clang_cc1 -fms-extensions -fno-rtti -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
2e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis
3e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis// CHECK: @"\01??_7D@C@?1??foo@@YAXXZ@6B@" =
4e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis// CHECK: @"\01??_7B@?1??foo@A@@QAEXH@Z@6B@" =
5e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis// CHECK: define {{.*}} @"\01?baz@E@?3??bar@C@?1??foo@@YAXXZ@QAEXXZ@QAEXXZ"(
6e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis
7e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis// Microsoft Visual C++ ABI examples.
8e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davisstruct A {
9e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis  void foo (int) {
10e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis    struct B { virtual ~B() {} };
11e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis    B();
12e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis  }
13e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis};
14651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesinline void foo () {
15e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis  struct C {
16e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis    struct D { virtual ~D() {} };
17e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis    void bar () {
18e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis      struct E {
19e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis        void baz() { }
20e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis      };
21e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis      E().baz();
22e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis    }
23e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis  };
24e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis  A().foo(0);
25e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis  C::D();
26e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis  C().bar();
27e0deb035b3e2d07b41ea55db84b110abcb65b753Charles Davis}
28651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesvoid call () {
29651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  foo();
30651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines}
31