xref: /llvm-project/clang/test/CodeGenCXX/cxx-abi-switch.cpp (revision 1b9a6e58a8b831193c9e5e733f881aabe0d2d06b)
184c47543SLeonard Chan // Assert that the ABI switch uses the proper codegen. Fuchsia uses the
284c47543SLeonard Chan // "return this" ABI on constructors and destructors by default, but if we
384c47543SLeonard Chan // explicitly choose the generic itanium C++ ABI, we should not return "this" on
484c47543SLeonard Chan // ctors/dtors.
584c47543SLeonard Chan //
6*1b9a6e58SNikita Popov // RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-unknown-fuchsia -fc++-abi=itanium | FileCheck %s
7*1b9a6e58SNikita Popov // RUN: %clang_cc1 %s -emit-llvm -o - -triple=aarch64-unknown-fuchsia -fc++-abi=itanium | FileCheck %s
884c47543SLeonard Chan 
984c47543SLeonard Chan class A {
1084c47543SLeonard Chan public:
1184c47543SLeonard Chan   virtual ~A();
1284c47543SLeonard Chan   int x_;
1384c47543SLeonard Chan };
1484c47543SLeonard Chan 
1584c47543SLeonard Chan class B : public A {
1684c47543SLeonard Chan public:
1784c47543SLeonard Chan   B(int *i);
1884c47543SLeonard Chan   virtual ~B();
1984c47543SLeonard Chan   int *i_;
2084c47543SLeonard Chan };
2184c47543SLeonard Chan 
B(int * i)2284c47543SLeonard Chan B::B(int *i) : i_(i) {}
~B()2384c47543SLeonard Chan B::~B() {}
2484c47543SLeonard Chan 
25*1b9a6e58SNikita Popov // CHECK: define{{.*}} void @_ZN1BC2EPi(ptr {{[^,]*}} %this, ptr noundef %i)
26*1b9a6e58SNikita Popov // CHECK: define{{.*}} void @_ZN1BC1EPi(ptr {{[^,]*}} %this, ptr noundef %i)
27*1b9a6e58SNikita Popov // CHECK: define{{.*}} void @_ZN1BD2Ev(ptr {{[^,]*}} %this)
28*1b9a6e58SNikita Popov // CHECK: define{{.*}} void @_ZN1BD1Ev(ptr {{[^,]*}} %this)
29