| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir |
| 2 |
// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR --implicit-check-not=externNotCalled \ |
| 3 |
// RUN: --implicit-check-not=internalNotCalled --implicit-check-not=inlineNotCalled |
| 4 |
|
| 5 |
extern int externCalled(); |
| 6 |
extern int externNotCalled(); |
| 7 |
|
| 8 |
namespace { |
| 9 |
int internalCalled() { return 1; } |
| 10 |
int internalNotCalled() { return 2; } |
| 11 |
} |
| 12 |
|
| 13 |
struct S { |
| 14 |
int inlineCalled() { return 3; } |
| 15 |
int inlineNotCalled() { return 4; } |
| 16 |
}; |
| 17 |
|
| 18 |
void use() { |
| 19 |
S s; |
| 20 |
externCalled(); |
| 21 |
internalCalled(); |
| 22 |
s.inlineCalled(); |
| 23 |
} |
| 24 |
|
| 25 |
// CIR: cir.func{{.*}} @_Z12externCalledv |
| 26 |
// This shouldn't have a body. |
| 27 |
// CIR-NOT: cir.return |
| 28 |
|
| 29 |
// CIR: cir.func{{.*}} @_ZN12_GLOBAL__N_114internalCalledEv |
| 30 |
// CIR: %[[ONE:.*]] = cir.const #cir.int<1> |
| 31 |
// CIR: cir.store %[[ONE]], %[[RET_ADDR:.*]] |
| 32 |
|
| 33 |
// CIR: cir.func{{.*}} @_ZN1S12inlineCalledEv |
| 34 |
// CIR: %[[THIS:.*]] = cir.alloca !cir.ptr<!rec_S>, !cir.ptr<!cir.ptr<!rec_S>>, ["this", init] |
| 35 |
// CIR: %[[THREE:.*]] = cir.const #cir.int<3> |
| 36 |
// CIR: cir.store %[[THREE]], %[[RET_ADDR:.*]] |
| 37 |
|
| 38 |
// CIR: cir.func{{.*}} @_Z3usev() |