diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
commit | 36981b17ed939300f6f8fc2355a255f711fcef71 (patch) | |
tree | ee2483e98b09cac943dc93a6969d83ca737ff139 /test/CodeGen/char-literal.c | |
parent | 180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff) | |
download | src-36981b17ed939300f6f8fc2355a255f711fcef71.tar.gz src-36981b17ed939300f6f8fc2355a255f711fcef71.zip |
Vendor import of clang release_30 branch r142614:vendor/clang/clang-r142614
Notes
Notes:
svn path=/vendor/clang/dist/; revision=226586
svn path=/vendor/clang/clang-r142614/; revision=226587; tag=vendor/clang/clang-r142614
Diffstat (limited to 'test/CodeGen/char-literal.c')
-rw-r--r-- | test/CodeGen/char-literal.c | 78 |
1 files changed, 68 insertions, 10 deletions
diff --git a/test/CodeGen/char-literal.c b/test/CodeGen/char-literal.c index 322041c0049a..5963ede392af 100644 --- a/test/CodeGen/char-literal.c +++ b/test/CodeGen/char-literal.c @@ -1,35 +1,93 @@ -// RUN: %clang_cc1 -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s -// Runs in c++ mode so that wchar_t is available. +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=C %s +// RUN: %clang_cc1 -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=C %s +// RUN: %clang_cc1 -x c++ -std=c++11 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CPP0X %s + +#include <stddef.h> int main() { - // CHECK: store i8 97 + // CHECK-C: store i8 97 + // CHECK-CPP0X: store i8 97 char a = 'a'; // Should pick second character. - // CHECK: store i8 98 + // CHECK-C: store i8 98 + // CHECK-CPP0X: store i8 98 char b = 'ab'; - // CHECK: store i32 97 + // CHECK-C: store i32 97 + // CHECK-CPP0X: store i32 97 wchar_t wa = L'a'; // Should pick second character. - // CHECK: store i32 98 + // CHECK-C: store i32 98 + // CHECK-CPP0X: store i32 98 wchar_t wb = L'ab'; +#if __cplusplus >= 201103L + // CHECK-CPP0X: store i16 97 + char16_t ua = u'a'; + + // Should pick second character. + // CHECK-CPP0X: store i16 98 + char16_t ub = u'ab'; + + // CHECK-CPP0X: store i32 97 + char32_t Ua = U'a'; + + // Should pick second character. + // CHECK-CPP0X: store i32 98 + char32_t Ub = U'ab'; +#endif + // Should pick last character and store its lowest byte. // This does not match gcc, which takes the last character, converts it to // utf8, and then picks the second-lowest byte of that (they probably store // the utf8 in uint16_ts internally and take the lower byte of that). - // CHECK: store i8 48 + // CHECK-C: store i8 48 + // CHECK-CPP0X: store i8 48 char c = '\u1120\u0220\U00102030'; - // CHECK: store i32 61451 + // CHECK-C: store i32 61451 + // CHECK-CPP0X: store i32 61451 wchar_t wc = L'\uF00B'; - // CHECK: store i32 1110027 +#if __cplusplus >= 201103L + // -4085 == 0xf00b + // CHECK-CPP0X: store i16 -4085 + char16_t uc = u'\uF00B'; + + // CHECK-CPP0X: store i32 61451 + char32_t Uc = U'\uF00B'; +#endif + + // CHECK-C: store i32 1110027 + // CHECK-CPP0X: store i32 1110027 wchar_t wd = L'\U0010F00B'; +#if __cplusplus >= 201103L + // Should take lower word of the 4byte UNC sequence. This does not match + // gcc. I don't understand what gcc does (it looks like it converts to utf16, + // then takes the second (!) utf16 word, swaps the lower two nibbles, and + // stores that?). + // CHECK-CPP0X: store i16 -4085 + char16_t ud = u'\U0010F00B'; // has utf16 encoding dbc8 dcb0 + + // CHECK-CPP0X: store i32 1110027 + char32_t Ud = U'\U0010F00B'; +#endif + // Should pick second character. - // CHECK: store i32 1110027 + // CHECK-C: store i32 1110027 + // CHECK-CPP0X: store i32 1110027 wchar_t we = L'\u1234\U0010F00B'; + +#if __cplusplus >= 201103L + // Should pick second character. + // CHECK-CPP0X: store i16 -4085 + char16_t ue = u'\u1234\U0010F00B'; + + // Should pick second character. + // CHECK-CPP0X: store i32 1110027 + char32_t Ue = U'\u1234\U0010F00B'; +#endif } |