Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / char-literal.c
blob16126fd5e977293c0d0ec4d8d90f3ef323020429
1 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-C %s
2 // RUN: %clang_cc1 -x c++ -std=c++11 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-CPP0X %s
4 #include <stddef.h>
6 int main(void) {
7 // CHECK-C: store i8 97
8 // CHECK-CPP0X: store i8 97
9 char a = 'a';
11 // Should truncate value (equal to last character).
12 // CHECK-C: store i8 98
13 // CHECK-CPP0X: store i8 98
14 char b = 'ab';
16 // Should get concatenated characters
17 // CHECK-C: store i32 24930
18 // CHECK-CPP0X: store i32 24930
19 int b1 = 'ab';
21 // Should get concatenated characters
22 // CHECK-C: store i32 808464432
23 // CHECK-CPP0X: store i32 808464432
24 int b2 = '0000';
26 // Should get truncated value (last four characters concatenated)
27 // CHECK-C: store i32 1919512167
28 // CHECK-CPP0X: store i32 1919512167
29 int b3 = 'somesillylongstring';
31 // CHECK-C: store i32 97
32 // CHECK-CPP0X: store i32 97
33 wchar_t wa = L'a';
35 #if __cplusplus >= 201103L
36 // CHECK-CPP0X: store i16 97
37 char16_t ua = u'a';
39 // CHECK-CPP0X: store i32 97
40 char32_t Ua = U'a';
42 // CHECK-CPP0X: store i16 1047
43 char16_t ua1 = u'З';
44 // CHECK-CPP0X: store i16 12538
45 char16_t ua2 = u'ヺ';
46 // CHECK-CPP0X: store i16 -27177
47 char16_t ua3 = u'闗';
49 // CHECK-CPP0X: store i32 181
50 char32_t Ua1 = U'µ';
51 // CHECK-CPP0X: store i32 38359
52 char32_t Ua2 = U'闗';
53 // CHECK-CPP0X: store i32 128128
54 char32_t Ua3 = U'💀';
56 #endif
58 // CHECK-C: store i32 61451
59 // CHECK-CPP0X: store i32 61451
60 wchar_t wc = L'\uF00B';
62 #if __cplusplus >= 201103L
63 // -4085 == 0xf00b
64 // CHECK-CPP0X: store i16 -4085
65 char16_t uc = u'\uF00B';
67 // CHECK-CPP0X: store i32 61451
68 char32_t Uc = U'\uF00B';
69 #endif
71 // CHECK-C: store i32 1110027
72 // CHECK-CPP0X: store i32 1110027
73 wchar_t wd = L'\U0010F00B';
75 #if __cplusplus >= 201103L
76 // CHECK-CPP0X: store i32 1110027
77 char32_t Ud = U'\U0010F00B';
78 #endif