39 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir2// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR --implicit-check-not=externNotCalled \3// RUN: --implicit-check-not=internalNotCalled --implicit-check-not=inlineNotCalled4 5extern int externCalled();6extern int externNotCalled();7 8namespace {9 int internalCalled() { return 1; }10 int internalNotCalled() { return 2; }11}12 13struct S {14 int inlineCalled() { return 3; }15 int inlineNotCalled() { return 4; }16};17 18void use() {19 S s;20 externCalled();21 internalCalled();22 s.inlineCalled();23}24 25// CIR: cir.func{{.*}} @_Z12externCalledv26// This shouldn't have a body.27// CIR-NOT: cir.return28 29// CIR: cir.func{{.*}} @_ZN12_GLOBAL__N_114internalCalledEv30// CIR: %[[ONE:.*]] = cir.const #cir.int<1>31// CIR: cir.store %[[ONE]], %[[RET_ADDR:.*]]32 33// CIR: cir.func{{.*}} @_ZN1S12inlineCalledEv34// 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()39