diff options
| author | Steve Naroff <snaroff@apple.com> | 2009-03-30 23:46:03 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2009-03-30 23:46:03 +0000 |
| commit | 7b753d21b54d042cae9ee97b4d75c18babfbfd76 (patch) | |
| tree | dfcac8feeb44c3eaa9ed682bf97370e33c3a6151 /clang/test/Sema/ucn-cstring.c | |
| parent | 29f80c343b20226a57e80a33c8279377c4094129 (diff) | |
| download | bcm5719-llvm-7b753d21b54d042cae9ee97b4d75c18babfbfd76.tar.gz bcm5719-llvm-7b753d21b54d042cae9ee97b4d75c18babfbfd76.zip | |
Implement UCN support for C string literals (C99 6.4.3) and add some very basic tests. Chris Goller has graciously offered to write some test to help validate UCN support.
From a front-end perspective, I believe this code should work for ObjC @-strings. At the moment, I believe we need to tweak the code generation for @-strings (which doesn't appear to handle them). Will be investigating.
llvm-svn: 68076
Diffstat (limited to 'clang/test/Sema/ucn-cstring.c')
| -rw-r--r-- | clang/test/Sema/ucn-cstring.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Sema/ucn-cstring.c b/clang/test/Sema/ucn-cstring.c new file mode 100644 index 00000000000..ec760f4180e --- /dev/null +++ b/clang/test/Sema/ucn-cstring.c @@ -0,0 +1,15 @@ +// RUN: clang-cc %s -verify -fsyntax-only -pedantic + +#include <stdio.h> + +int main(void) { + printf("%s (%d)\n", "hello \u2192 \u2603 \u2190 world", sizeof("hello \u2192 \u2603 \u2190 world")); + printf("%s (%d)\n", "\U00010400\U0001D12B", sizeof("\U00010400\U0001D12B")); + // Some error conditions... + printf("%s\n", "\U"); // expected-error{{\u used with no following hex digits}} + printf("%s\n", "\U00"); // expected-error{{incomplete universal character name}} + printf("%s\n", "\U0001"); // expected-error{{incomplete universal character name}} + printf("%s\n", "\u0001"); // expected-error{{invalid universal character}} + return 0; +} + |

