27 lines · c
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 52// RUN: %clang_cc1 -std=c2y -emit-llvm -o - %s | FileCheck %s3 4// This tests the non-VLA codegen behavior for _Countof.5 6typedef 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], align12// CHECK-NEXT: ret i{{64|32}} 1213//14size_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}} 10023//24size_t test2() {25 return _Countof(float[100]);26}27