1 // RUN: %clang_cc1 -std=c2x -emit-llvm %s -o - | FileCheck %s
3 void basic_types(void) {
4 auto nb
= 4; // CHECK: alloca i32
5 auto dbl
= 4.3; // CHECK: alloca double
6 auto lng
= 4UL; // CHECK: alloca i{{32|64}}
7 auto bl
= true; // CHECK: alloca i8
8 auto chr
= 'A'; // CHECK: alloca i{{8|32}}
9 auto str
= "Test"; // CHECK: alloca ptr
10 auto str2
[] = "Test"; // CHECK: alloca [5 x i8]
11 auto nptr
= nullptr; // CHECK: alloca ptr
14 void misc_declarations(void) {
15 // FIXME: this should end up being rejected when we implement underspecified
16 // declarations in N3006.
17 auto strct_ptr
= (struct { int a
; } *)0; // CHECK: alloca ptr
18 auto int_cl
= (int){13}; // CHECK: alloca i32
19 auto double_cl
= (double){2.5}; // CHECK: alloca double
21 auto se
= ({ // CHECK: alloca i32
22 auto snb
= 12; // CHECK: alloca i32
28 auto j
= 4; // CHECK: alloca i32
29 for (auto i
= j
; i
< 2 * j
; i
++); // CHECK: alloca i32
32 #define AUTO_MACRO(_NAME, ARG, ARG2, ARG3) auto _NAME = ARG + (ARG2 / ARG3);
34 #define AUTO_INT_MACRO(_NAME, ARG, ARG2, ARG3) auto _NAME = (ARG ^ ARG2) & ARG3;
36 int macros(int in_int
) {
37 auto a
= in_int
+ 1; // CHECK: alloca i32
38 AUTO_MACRO(b
, 1.3, 2.5f
, 3); // CHECK: alloca double
39 AUTO_INT_MACRO(c
, 64, 23, 0xff); // CHECK: alloca i32
40 return (a
+ (int)b
) - c
; // CHECK: ret i32 %{{.*}}