llvm-project/clang/test/CIR/func-linkage.cpp
Henrich Lauko 04dd71cb0b
[CIR] Align inline-kind FuncOp attribute with incubator (#170050)
Switches to more efficient explicit enum property instead of a wrapped
storage, simplifying the string representation. The attribute is now
placed before the symbol name for consistency with other FuncOp
attributes. FileCheck patterns are also simplified to match only the
attributes under test.
2025-12-02 09:53:50 +01:00

52 lines
1.5 KiB
C++

// Linkage types of global variables
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck %s -check-prefix=CIR --input-file %t.cir
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll
// RUN: FileCheck %s -check-prefix=LLVM --input-file %t-cir.ll
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
// RUN: FileCheck %s -check-prefix=OGCG --input-file %t.ll
void a() {}
// CIR: cir.func no_inline dso_local @_Z1av()
// LLVM: define dso_local void @_Z1av()
// OGCG: define dso_local void @_Z1av()
extern void b();
// CIR: cir.func private @_Z1bv()
// LLVM: declare void @_Z1bv()
// OGCG: declare void @_Z1bv()
static void c() {}
// CIR: cir.func no_inline internal private dso_local @_ZL1cv()
// LLVM: define internal void @_ZL1cv()
// OGCG: define internal void @_ZL1cv()
inline void d() {}
// CIR: cir.func {{.*}} comdat linkonce_odr @_Z1dv()
// LLVM: define linkonce_odr void @_Z1dv()
// OGCG: define linkonce_odr void @_Z1dv(){{.*}} comdat
namespace {
void e() {}
}
// CIR: cir.func {{.*}} internal private dso_local @_ZN12_GLOBAL__N_11eEv()
// LLVM: define internal void @_ZN12_GLOBAL__N_11eEv()
// OGCG: define internal void @_ZN12_GLOBAL__N_11eEv()
void f();
// CIR: cir.func private @_Z1fv()
// LLVM: declare void @_Z1fv()
// OGCG: declare void @_Z1fv()
// Force the functions to be emitted
void reference_funcs() {
a();
b();
c();
d();
e();
f();
}