Debian Codegraph @

clang/test/C/C2y/n3369_2.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2 // RUN: %clang_cc1 -std=c2y -emit-llvm -o - %s | FileCheck %s
3
4 // This tests the non-VLA codegen behavior for _Countof.
5
6 typedef typeof(sizeof(0)) size_t;
7
8 // CHECK-LABEL: define{{( dso_local)?}} i{{64|32}} @test1(
9 // CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
10 // CHECK-NEXT: [[ENTRY:.*:]]
11 // CHECK-NEXT: [[ARRAY:%.*]] = alloca [12 x i32], align
12 // CHECK-NEXT: ret i{{64|32}} 12
13 //
14 size_t test1() {
15 int array[12];
16 return _Countof(array);
17 }
18
19 // CHECK-LABEL: define{{( dso_local)?}} i{{64|32}} @test2(
20 // CHECK-SAME: ) #[[ATTR0]] {
21 // CHECK-NEXT: [[ENTRY:.*:]]
22 // CHECK-NEXT: ret i{{64|32}} 100
23 //
24 size_t test2() {
25 return _Countof(float[100]);
26 }