brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · d43f7ed Raw
52 lines · cpp
1// Linkage types of global variables2// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir3// RUN: FileCheck %s -check-prefix=CIR --input-file %t.cir4// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll5// RUN: FileCheck %s -check-prefix=LLVM --input-file %t-cir.ll6// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll7// RUN: FileCheck %s -check-prefix=OGCG --input-file %t.ll8 9void a() {}10 11// CIR: cir.func dso_local @_Z1av()12// LLVM: define dso_local void @_Z1av()13// OGCG: define dso_local void @_Z1av()14 15extern void b();16// CIR: cir.func private @_Z1bv()17// LLVM: declare void @_Z1bv()18// OGCG: declare void @_Z1bv()19 20static void c() {}21// CIR: cir.func internal private dso_local @_ZL1cv()22// LLVM: define internal void @_ZL1cv()23// OGCG: define internal void @_ZL1cv()24 25inline void d() {}26// CIR: cir.func comdat linkonce_odr @_Z1dv()27// LLVM: define linkonce_odr void @_Z1dv()28// OGCG: define linkonce_odr void @_Z1dv(){{.*}} comdat29 30namespace {31  void e() {}32}33 34// CIR: cir.func internal private dso_local @_ZN12_GLOBAL__N_11eEv()35// LLVM: define internal void @_ZN12_GLOBAL__N_11eEv()36// OGCG: define internal void @_ZN12_GLOBAL__N_11eEv()37 38void f();39// CIR: cir.func private @_Z1fv()40// LLVM: declare void @_Z1fv()41// OGCG: declare void @_Z1fv()42 43// Force the functions to be emitted44void reference_funcs() {45    a();46    b();47    c();48    d();49    e();50    f();51}52