[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / const-dynamic-init.cpp
blobec53daa9ea2a4f71f5264fae2b768917ee7c016d
1 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
3 __attribute__((section("A")))
4 const int a = 1;
5 const int *f() { return &a; }
6 // CHECK: @_ZL1a = internal constant i32 1, section "A"
8 int init();
9 __attribute__((section("B")))
10 const int b = init();
11 // Even if it's const-qualified, it must not be LLVM IR `constant` since it's
12 // dynamically initialised.
13 // CHECK: @_ZL1b = internal global i32 0, section "B"
15 __attribute__((section("C")))
16 int c = 2;
17 // CHECK: @c = {{.*}}global i32 2, section "C"
19 __attribute__((section("D")))
20 int d = init();
21 // CHECK: @d = {{.*}}global i32 0, section "D"
23 __attribute__((section("E")))
24 int e;
25 // CHECK: @e = {{.*}}global i32 0, section "E", align 4