summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-06 03:21:47 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-06 03:21:47 +0000
commitd67aea28f6cb180291f95690ece485740f3fe859 (patch)
tree9d4fa42ed4f930bbeeca769b01d37778b2f8e9ec /clang/lib/Parse/Parser.cpp
parent8de07444410eb8e56e1799cd9b1244cdb81e0142 (diff)
downloadbcm5719-llvm-d67aea28f6cb180291f95690ece485740f3fe859.tar.gz
bcm5719-llvm-d67aea28f6cb180291f95690ece485740f3fe859.zip
User-defined literals: reject string and character UDLs in all places where the
grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r--clang/lib/Parse/Parser.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 6a479bc60cb..8b1765df393 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -1127,9 +1127,13 @@ Parser::ExprResult Parser::ParseAsmStringLiteral() {
switch (Tok.getKind()) {
case tok::string_literal:
break;
+ case tok::utf8_string_literal:
+ case tok::utf16_string_literal:
+ case tok::utf32_string_literal:
case tok::wide_string_literal: {
SourceLocation L = Tok.getLocation();
Diag(Tok, diag::err_asm_operand_wide_string_literal)
+ << (Tok.getKind() == tok::wide_string_literal)
<< SourceRange(L, L);
return ExprError();
}
@@ -1138,10 +1142,7 @@ Parser::ExprResult Parser::ParseAsmStringLiteral() {
return ExprError();
}
- ExprResult Res(ParseStringLiteralExpression());
- if (Res.isInvalid()) return move(Res);
-
- return move(Res);
+ return ParseStringLiteralExpression();
}
/// ParseSimpleAsm
OpenPOWER on IntegriCloud