blob: 3e5b7fb041129ec938acfb0b4c887a56e9231bb7 [file] [log] [blame]
Eli Friedmanf12e1b92011-11-01 02:26:36 +00001// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=C %s
2// RUN: %clang_cc1 -x c++ -std=c++0x -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CPP0X %s
3// RUN: %clang_cc1 -x c++ -std=c++0x -fshort-wchar -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=SHORTWCHAR %s
4
5// This file contains a mix of ISO-8859-1 and UTF-8 encoded data.
6// the literal assigned to 'aa' should be the ISO-8859-1 encoding for the code
7// points U+00C0 U+00E9 U+00EE U+00F5 U+00FC
8
9// The rest of the literals should contain the UTF-8 encoding for U+041A U+043E
10// U+0448 U+043A U+0430
11
12#ifndef __cplusplus
Eli Friedman8bb6e9e2011-11-01 03:35:57 +000013#include <stddef.h>
Eli Friedmanf12e1b92011-11-01 02:26:36 +000014#endif
15
16#ifdef __cplusplus
17extern "C"
18#endif
19void f() {
20 // CHECK-C: private unnamed_addr constant [6 x i8] c"\C0\E9\EE\F5\FC\00", align 1
21 // CHECK-CPP0X: private unnamed_addr constant [6 x i8] c"\C0\E9\EE\F5\FC\00", align 1
22 char const *aa = "Àéîõü";
23
24 // CHECK-C: private unnamed_addr constant [11 x i8] c"\D0\9A\D0\BE\D1\88\D0\BA\D0\B0\00", align 1
25 // CHECK-CPP0X: private unnamed_addr constant [11 x i8] c"\D0\9A\D0\BE\D1\88\D0\BA\D0\B0\00", align 1
26 char const *a = "Кошка";
27
28 // CHECK-C: private unnamed_addr constant [6 x i32] [i32 1050, i32 1086, i32 1096, i32 1082, i32 1072, i32 0], align 4
29 // CHECK-SHORTWCHAR: private unnamed_addr constant [6 x i16] [i16 1050, i16 1086, i16 1096, i16 1082, i16 1072, i16 0], align 2
30 // CHECK-CPP0X: private unnamed_addr constant [6 x i32] [i32 1050, i32 1086, i32 1096, i32 1082, i32 1072, i32 0], align 4
31 wchar_t const *b = L"Кошка";
Nico Weber9b483df2011-11-14 05:17:37 +000032
33 // CHECK-C: private unnamed_addr constant [4 x i32] [i32 20320, i32 22909, i32 66304, i32 0], align 4
34 // CHECK-SHORTWCHAR: private unnamed_addr constant [4 x i16] [i16 20320, i16 22909, i16 768, i16 0], align 2
35 // CHECK-CPP0X: private unnamed_addr constant [4 x i32] [i32 20320, i32 22909, i32 66304, i32 0], align 4
36 wchar_t const *b2 = L"\x4f60\x597d\x10300";
Eli Friedmanf12e1b92011-11-01 02:26:36 +000037
38#if __cplusplus >= 201103L
39
40 // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"1\D0\9A\D0\BE\D1\88\D0\BA\D0\B0\00", align 1
41 char const *c = u8"1Кошка";
42
43 // CHECK-CPP0X: private unnamed_addr constant [7 x i16] [i16 50, i16 1050, i16 1086, i16 1096, i16 1082, i16 1072, i16 0], align 2
44 char16_t const *e = u"2Кошка";
45
46 // CHECK-CPP0X: private unnamed_addr constant [7 x i32] [i32 51, i32 1050, i32 1086, i32 1096, i32 1082, i32 1072, i32 0], align 4
47 char32_t const *f = U"3Кошка";
48
49 // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"4\D0\9A\D0\BE\D1\88\D0\BA\D0\B0\00", align 1
50 char const *d = u8R"(4Кошка)";
51
52 // CHECK-CPP0X: private unnamed_addr constant [7 x i16] [i16 53, i16 1050, i16 1086, i16 1096, i16 1082, i16 1072, i16 0], align 2
53 char16_t const *g = uR"(5Кошка)";
54
55 // CHECK-CPP0X: private unnamed_addr constant [7 x i32] [i32 54, i32 1050, i32 1086, i32 1096, i32 1082, i32 1072, i32 0], align 4
56 char32_t const *h = UR"(6Кошка)";
57
58 // CHECK-SHORTWCHAR: private unnamed_addr constant [7 x i16] [i16 55, i16 1050, i16 1086, i16 1096, i16 1082, i16 1072, i16 0], align 2
59 // CHECK-CPP0X: private unnamed_addr constant [7 x i32] [i32 55, i32 1050, i32 1086, i32 1096, i32 1082, i32 1072, i32 0], align 4
60 wchar_t const *i = LR"(7Кошка)";
61
62#endif
63}