| 1 |
// RUN: %clang_cc1 -triple=x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s |
| 2 |
|
| 3 |
class Class1 { |
| 4 |
public: |
| 5 |
[[clang::not_tail_called]] int m1(); |
| 6 |
int m2(); |
| 7 |
[[clang::not_tail_called]] virtual int m3(); |
| 8 |
virtual int m4(); |
| 9 |
}; |
| 10 |
|
| 11 |
class Class2: public Class1 { |
| 12 |
public: |
| 13 |
[[clang::not_tail_called]] int m4() override; |
| 14 |
}; |
| 15 |
|
| 16 |
int foo1(int a, Class1 *c1, Class2 &c2) { |
| 17 |
if (a) |
| 18 |
return c1->m1(); |
| 19 |
c1->m3(); |
| 20 |
Class1 &c = c2; |
| 21 |
c.m4(); |
| 22 |
c2.m4(); |
| 23 |
return c1->m2(); |
| 24 |
} |
| 25 |
|
| 26 |
// CHECK-LABEL: define{{.*}} i32 @_Z4foo1iP6Class1R6Class2( |
| 27 |
// CHECK: %{{[a-z0-9]+}} = notail call noundef i32 @_ZN6Class12m1Ev(ptr |
| 28 |
// CHECK: %{{[a-z0-9]+}} = notail call noundef i32 %{{[0-9]+}}(ptr |
| 29 |
// CHECK-NOT: %{{[a-z0-9]+}} = notail call noundef i32 %{{[0-9]+}}(ptr |
| 30 |
// CHECK: %{{[a-z0-9]+}} = notail call noundef i32 %{{[0-9]+}}(ptr |
| 31 |
// CHECK: %{{[a-z0-9]+}} = call noundef i32 @_ZN6Class12m2Ev(ptr |