<div class="gmail_quote">On Thu, Mar 8, 2012 at 9:22 AM, Matt Beaumont-Gay <span dir="ltr"><<a href="mailto:matthewbg@google.com">matthewbg@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Mar 8, 2012 at 00:45, Richard Smith <<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>> wrote:<br>
> Author: rsmith<br>
> Date: Thu Mar 8 02:45:32 2012<br>
> New Revision: 152302<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=152302&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=152302&view=rev</a><br>
> Log:<br>
> Add support for cooked forms of user-defined-integer-literal and<br>
> user-defined-floating-literal. Support for raw forms of these literals<br>
> to follow.<br>
><br>
> Added:<br>
> cfe/trunk/test/SemaCXX/cxx11-user-defined-literals.cpp<br>
> Modified:<br>
> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td<br>
> cfe/trunk/include/clang/Lex/LiteralSupport.h<br>
> cfe/trunk/lib/Lex/LiteralSupport.cpp<br>
> cfe/trunk/lib/Lex/PPExpressions.cpp<br>
> cfe/trunk/lib/Sema/SemaExpr.cpp<br>
> cfe/trunk/test/CodeGenCXX/cxx11-user-defined-literal.cpp<br>
> cfe/trunk/test/Parser/cxx11-user-defined-literals.cpp<br>
><br>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=152302&r1=152301&r2=152302&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=152302&r1=152301&r2=152302&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)<br>
> +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Thu Mar 8 02:45:32 2012<br>
> @@ -146,9 +146,9 @@<br>
> def err_string_concat_mixed_suffix : Error<<br>
> "differing user-defined suffixes ('%0' and '%1') in string literal "<br>
> "concatenation">;<br>
> -def err_pp_invalid_char_udl : Error<<br>
> - "character literal with user-defined suffix cannot be used in preprocessor "<br>
> - "constant expression">;<br>
> +def err_pp_invalid_udl : Error<<br>
> + "%select{character|integer}0 literal with user-defined suffix "<br>
> + "cannot be used in preprocessor constant expression">;<br>
> def err_bad_string_encoding : Error<<br>
> "illegal character encoding in string literal">;<br>
> def warn_bad_string_encoding : ExtWarn<<br>
><br>
> Modified: cfe/trunk/include/clang/Lex/LiteralSupport.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/LiteralSupport.h?rev=152302&r1=152301&r2=152302&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/LiteralSupport.h?rev=152302&r1=152301&r2=152302&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Lex/LiteralSupport.h (original)<br>
> +++ cfe/trunk/include/clang/Lex/LiteralSupport.h Thu Mar 8 02:45:32 2012<br>
> @@ -45,7 +45,7 @@<br>
><br>
> unsigned radix;<br>
><br>
> - bool saw_exponent, saw_period;<br>
> + bool saw_exponent, saw_period, saw_ud_suffix;<br>
><br>
> public:<br>
> NumericLiteralParser(const char *begin, const char *end,<br>
> @@ -64,8 +64,17 @@<br>
> bool isFloatingLiteral() const {<br>
> return saw_period || saw_exponent;<br>
> }<br>
> - bool hasSuffix() const {<br>
> - return SuffixBegin != ThisTokEnd;<br>
> +<br>
> + bool hasUDSuffix() const {<br>
> + return saw_ud_suffix;<br>
> + }<br>
> + StringRef getUDSuffix() const {<br>
> + assert(saw_ud_suffix);<br>
> + return StringRef(SuffixBegin, ThisTokEnd - SuffixBegin);<br>
> + }<br>
> + unsigned getUDSuffixOffset() const {<br>
> + assert(saw_ud_suffix);<br>
> + return SuffixBegin - ThisTokBegin;<br>
> }<br>
><br>
> unsigned getRadix() const { return radix; }<br>
><br>
> Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=152302&r1=152301&r2=152302&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=152302&r1=152301&r2=152302&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)<br>
> +++ cfe/trunk/lib/Lex/LiteralSupport.cpp Thu Mar 8 02:45:32 2012<br>
> @@ -333,6 +333,10 @@<br>
> /// decimal-constant integer-suffix<br>
> /// octal-constant integer-suffix<br>
> /// hexadecimal-constant integer-suffix<br>
> +/// user-defiend-integer-literal: [C++11 lex.ext]<br>
<br>
s/defiend/defined/<br>
</blockquote></div><br><div>Thanks, fixed in passing in 152344.<br></div>