diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-03-09 23:30:15 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-03-09 23:30:15 +0000 |
commit | 0b91cc47a5642de2e1f567fe0f29420acdcdebbe (patch) | |
tree | da9ba236bf1ef7158a594a6883a73464fc83ac3a /include/clang/Basic/TokenKinds.h | |
parent | 7cb583d13f996ffde671ea617c97303cebadd649 (diff) |
Handle _Pragma on a u8, u, or U string literal per the C11 specification. Also
handle raw string literals here. C++11 doesn't yet specify how they will
behave, but discussion on core suggests that we should just strip off
everything but the r-char-sequence.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TokenKinds.h')
-rw-r--r-- | include/clang/Basic/TokenKinds.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/clang/Basic/TokenKinds.h b/include/clang/Basic/TokenKinds.h index e850971e34..dcbe1da111 100644 --- a/include/clang/Basic/TokenKinds.h +++ b/include/clang/Basic/TokenKinds.h @@ -68,15 +68,21 @@ inline bool isAnyIdentifier(TokenKind K) { return (K == tok::identifier) || (K == tok::raw_identifier); } +/// \brief Return true if this is a C or C++ string-literal (or +/// C++11 user-defined-string-literal) token. +inline bool isStringLiteral(TokenKind K) { + return K == tok::string_literal || K == tok::wide_string_literal || + K == tok::utf8_string_literal || K == tok::utf16_string_literal || + K == tok::utf32_string_literal; +} + /// \brief Return true if this is a "literal" kind, like a numeric /// constant, string, etc. inline bool isLiteral(TokenKind K) { - return (K == tok::numeric_constant) || (K == tok::char_constant) || - (K == tok::wide_char_constant) || (K == tok::utf16_char_constant) || - (K == tok::utf32_char_constant) || (K == tok::string_literal) || - (K == tok::wide_string_literal) || (K == tok::utf8_string_literal) || - (K == tok::utf16_string_literal) || (K == tok::utf32_string_literal) || - (K == tok::angle_string_literal); + return K == tok::numeric_constant || K == tok::char_constant || + K == tok::wide_char_constant || K == tok::utf16_char_constant || + K == tok::utf32_char_constant || isStringLiteral(K) || + K == tok::angle_string_literal; } /// \brief Return true if this is any of tok::annot_* kinds. |