From 99831e4677a7e2e051af636221694d60ba31fcdb Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 6 Mar 2012 03:21:47 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152098 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/ModuleMap.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Lex/ModuleMap.cpp') diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 28043d1198..e6851afada 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -617,6 +617,12 @@ retry: break; case tok::string_literal: { + if (LToken.hasUDSuffix()) { + Diags.Report(LToken.getLocation(), diag::err_invalid_string_udl); + HadError = true; + goto retry; + } + // Parse the string literal. LangOptions LangOpts; StringLiteralParser StringLiteral(<oken, 1, SourceMgr, LangOpts, *Target); -- cgit v1.2.3