On Thu, Mar 8, 2012 at 00:45, Richard Smith <[email protected]> wrote: > Author: rsmith > Date: Thu Mar 8 02:45:32 2012 > New Revision: 152302 > > URL: http://llvm.org/viewvc/llvm-project?rev=152302&view=rev > Log: > Add support for cooked forms of user-defined-integer-literal and > user-defined-floating-literal. Support for raw forms of these literals > to follow. > > Added: > cfe/trunk/test/SemaCXX/cxx11-user-defined-literals.cpp > Modified: > cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td > cfe/trunk/include/clang/Lex/LiteralSupport.h > cfe/trunk/lib/Lex/LiteralSupport.cpp > cfe/trunk/lib/Lex/PPExpressions.cpp > cfe/trunk/lib/Sema/SemaExpr.cpp > cfe/trunk/test/CodeGenCXX/cxx11-user-defined-literal.cpp > cfe/trunk/test/Parser/cxx11-user-defined-literals.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=152302&r1=152301&r2=152302&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Thu Mar 8 02:45:32 > 2012 > @@ -146,9 +146,9 @@ > def err_string_concat_mixed_suffix : Error< > "differing user-defined suffixes ('%0' and '%1') in string literal " > "concatenation">; > -def err_pp_invalid_char_udl : Error< > - "character literal with user-defined suffix cannot be used in preprocessor > " > - "constant expression">; > +def err_pp_invalid_udl : Error< > + "%select{character|integer}0 literal with user-defined suffix " > + "cannot be used in preprocessor constant expression">; > def err_bad_string_encoding : Error< > "illegal character encoding in string literal">; > def warn_bad_string_encoding : ExtWarn< > > Modified: cfe/trunk/include/clang/Lex/LiteralSupport.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/LiteralSupport.h?rev=152302&r1=152301&r2=152302&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Lex/LiteralSupport.h (original) > +++ cfe/trunk/include/clang/Lex/LiteralSupport.h Thu Mar 8 02:45:32 2012 > @@ -45,7 +45,7 @@ > > unsigned radix; > > - bool saw_exponent, saw_period; > + bool saw_exponent, saw_period, saw_ud_suffix; > > public: > NumericLiteralParser(const char *begin, const char *end, > @@ -64,8 +64,17 @@ > bool isFloatingLiteral() const { > return saw_period || saw_exponent; > } > - bool hasSuffix() const { > - return SuffixBegin != ThisTokEnd; > + > + bool hasUDSuffix() const { > + return saw_ud_suffix; > + } > + StringRef getUDSuffix() const { > + assert(saw_ud_suffix); > + return StringRef(SuffixBegin, ThisTokEnd - SuffixBegin); > + } > + unsigned getUDSuffixOffset() const { > + assert(saw_ud_suffix); > + return SuffixBegin - ThisTokBegin; > } > > unsigned getRadix() const { return radix; } > > Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=152302&r1=152301&r2=152302&view=diff > ============================================================================== > --- cfe/trunk/lib/Lex/LiteralSupport.cpp (original) > +++ cfe/trunk/lib/Lex/LiteralSupport.cpp Thu Mar 8 02:45:32 2012 > @@ -333,6 +333,10 @@ > /// decimal-constant integer-suffix > /// octal-constant integer-suffix > /// hexadecimal-constant integer-suffix > +/// user-defiend-integer-literal: [C++11 lex.ext]
s/defiend/defined/ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
