diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2010-10-09 00:27:47 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2010-10-09 00:27:47 +0000 |
| commit | a6bde81bc8812c68518f4a828e36992944d01f60 (patch) | |
| tree | 1d91e1a06924f7ad5a1f0da6b943ce19665076fe /clang/test/CodeGen/char-literal.c | |
| parent | f9f78e3aaefac219ef67317ab021ebc61f5947a7 (diff) | |
| download | bcm5719-llvm-a6bde81bc8812c68518f4a828e36992944d01f60.tar.gz bcm5719-llvm-a6bde81bc8812c68518f4a828e36992944d01f60.zip | |
Add support for UCNs for character literals
llvm-svn: 116129
Diffstat (limited to 'clang/test/CodeGen/char-literal.c')
| -rw-r--r-- | clang/test/CodeGen/char-literal.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/CodeGen/char-literal.c b/clang/test/CodeGen/char-literal.c new file mode 100644 index 00000000000..aff76d280d3 --- /dev/null +++ b/clang/test/CodeGen/char-literal.c @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -x c++ -triple i386-unknown-unkown -emit-llvm %s -o - | FileCheck %s +// Runs in c++ mode so that wchar_t is available. + +int main() { + // CHECK: store i8 97 + char a = 'a'; + + // Should pick second character. + // CHECK: store i8 98 + char b = 'ab'; + + // CHECK: store i32 97 + wchar_t wa = L'a'; + + // Should pick second character. + // CHECK: store i32 98 + wchar_t wb = L'ab'; + + // 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 + char c = '\u1120\u0220\U00102030'; + + // CHECK: store i32 61451 + wchar_t wc = L'\uF00B'; + + // CHECK: store i32 1110027 + wchar_t wd = L'\U0010F00B'; + + // Should pick second character. + // CHECK: store i32 1110027 + wchar_t we = L'\u1234\U0010F00B'; +} |

