diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-06 03:21:47 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-06 03:21:47 +0000 |
commit | d67aea28f6cb180291f95690ece485740f3fe859 (patch) | |
tree | 9d4fa42ed4f930bbeeca769b01d37778b2f8e9ec /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | 8de07444410eb8e56e1799cd9b1244cdb81e0142 (diff) | |
download | bcm5719-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/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 978b2b362d1..89f024637e5 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -272,6 +272,11 @@ Decl *Parser::ParseLinkage(ParsingDeclSpec &DS, unsigned Context) { if (Invalid) return 0; + // FIXME: This is incorrect: linkage-specifiers are parsed in translation + // phase 7, so string-literal concatenation is supposed to occur. + // extern "" "C" "" "+" "+" { } is legal. + if (Tok.hasUDSuffix()) + Diag(Tok, diag::err_invalid_string_udl); SourceLocation Loc = ConsumeStringToken(); ParseScope LinkageScope(this, Scope::DeclScope); @@ -617,8 +622,10 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){ } ExprResult AssertMessage(ParseStringLiteralExpression()); - if (AssertMessage.isInvalid()) + if (AssertMessage.isInvalid()) { + SkipUntil(tok::semi); return 0; + } T.consumeClose(); |