diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 71b37527fd2..74df162b0b3 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -825,13 +825,24 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability, } ConsumeToken(); if (Keyword == Ident_message) { - if (Tok.isNot(tok::string_literal)) { // Also reject wide string literals. + if (Tok.isNot(tok::string_literal)) { Diag(Tok, diag::err_expected_string_literal) << /*Source='availability attribute'*/2; SkipUntil(tok::r_paren, StopAtSemi); return; } MessageExpr = ParseStringLiteralExpression(); + // Also reject wide string literals. + if (StringLiteral *MessageStringLiteral = + cast_or_null<StringLiteral>(MessageExpr.get())) { + if (MessageStringLiteral->getCharByteWidth() != 1) { + Diag(MessageStringLiteral->getSourceRange().getBegin(), + diag::err_expected_string_literal) + << /*Source='availability attribute'*/ 2; + SkipUntil(tok::r_paren, StopAtSemi); + return; + } + } break; } |