[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / attr-disable-tail-calls.cpp
bloba45d9e6f881faf22faadc51363db2e93dadb0287
1 // RUN: %clang_cc1 -triple=x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s
3 class B {
4 public:
5 [[clang::disable_tail_calls]] virtual int m1() { return 1; }
6 virtual int m2() { return 2; }
7 int m3() { return 3; }
8 [[clang::disable_tail_calls]] int m4();
9 };
11 class D : public B {
12 public:
13 int m1() override { return 11; }
14 [[clang::disable_tail_calls]] int m2() override { return 22; }
17 int foo1() {
18 B *b = new B;
19 D *d = new D;
20 int t = 0;
21 t += b->m1() + b->m2() + b->m3() + b->m4();
22 t += d->m1() + d->m2();
23 return t;
26 // CHECK: define linkonce_odr noundef i32 @_ZN1B2m3Ev(ptr {{[^,]*}} %this) [[ATTRFALSE:#[0-9]+]]
27 // CHECK: declare noundef i32 @_ZN1B2m4Ev(ptr {{[^,]*}}) [[ATTRTRUE0:#[0-9]+]]
28 // CHECK: define linkonce_odr noundef i32 @_ZN1B2m1Ev(ptr {{[^,]*}} %this) unnamed_addr [[ATTRTRUE1:#[0-9]+]]
29 // CHECK: define linkonce_odr noundef i32 @_ZN1B2m2Ev(ptr {{[^,]*}} %this) unnamed_addr [[ATTRFALSE:#[0-9]+]]
30 // CHECK: define linkonce_odr noundef i32 @_ZN1D2m1Ev(ptr {{[^,]*}} %this) unnamed_addr [[ATTRFALSE:#[0-9]+]]
31 // CHECK: define linkonce_odr noundef i32 @_ZN1D2m2Ev(ptr {{[^,]*}} %this) unnamed_addr [[ATTRTRUE1:#[0-9]+]]
33 // CHECK-NOT: attributes [[ATTRFALSE]] = { {{.*}}"disable-tail-calls"="false"{{.*}} }
34 // CHECK: attributes [[ATTRTRUE0]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }
35 // CHECK: attributes [[ATTRTRUE1]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }