diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-08 06:08:42 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-08 06:08:42 +0000 |
commit | 3e3a705062fe343dc397c0bf623aa383f14ce07c (patch) | |
tree | c22a037420f5961f40672567865afc4591809a78 /clang/lib/Lex/LiteralSupport.cpp | |
parent | cf29675d9501cfff2a37acb8af3eefa6cbba19c1 (diff) | |
download | bcm5719-llvm-3e3a705062fe343dc397c0bf623aa383f14ce07c.tar.gz bcm5719-llvm-3e3a705062fe343dc397c0bf623aa383f14ce07c.zip |
[c++1z] Support for u8 character literals.
llvm-svn: 221576
Diffstat (limited to 'clang/lib/Lex/LiteralSupport.cpp')
-rw-r--r-- | clang/lib/Lex/LiteralSupport.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index 096805c3cf5..03331fb33eb 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -28,6 +28,7 @@ static unsigned getCharWidth(tok::TokenKind kind, const TargetInfo &Target) { default: llvm_unreachable("Unknown token type!"); case tok::char_constant: case tok::string_literal: + case tok::utf8_char_constant: case tok::utf8_string_literal: return Target.getCharWidth(); case tok::wide_char_constant: @@ -1031,9 +1032,10 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, const char *TokBegin = begin; // Skip over wide character determinant. - if (Kind != tok::char_constant) { + if (Kind != tok::char_constant) + ++begin; + if (Kind == tok::utf8_char_constant) ++begin; - } // Skip over the entry quote. assert(begin[0] == '\'' && "Invalid token lexed"); @@ -1077,6 +1079,8 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, if (tok::wide_char_constant == Kind) { largest_character_for_kind = 0xFFFFFFFFu >> (32-PP.getTargetInfo().getWCharWidth()); + } else if (tok::utf8_char_constant == Kind) { + largest_character_for_kind = 0x7F; } else if (tok::utf16_char_constant == Kind) { largest_character_for_kind = 0xFFFF; } else if (tok::utf32_char_constant == Kind) { |