From: Richard Smith Date: Fri, 9 Mar 2012 08:41:27 +0000 (+0000) Subject: User-defined literals are done. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c1dda7d7b6336506764ce1b03baf4c03ed9ff92;p=clang User-defined literals are done. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152396 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html index 12a91c9e6f..cf61e9d92b 100644 --- a/docs/LanguageExtensions.html +++ b/docs/LanguageExtensions.html @@ -819,7 +819,7 @@ support for Unicode string literals is enabled.

C++11 user-defined literals

-

Use __has_feature(cxx_user_literals) to determine if support for user-defined literals is enabled. Clang does not currently support this feature.

+

Use __has_feature(cxx_user_literals) to determine if support for user-defined literals is enabled.

C++11 variadic templates

diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 5f9f1acf73..26e0ffb5d4 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -640,7 +640,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { .Case("c_atomic", LangOpts.C11) .Case("c_generic_selections", LangOpts.C11) .Case("c_static_assert", LangOpts.C11) - // C++0x features + // C++11 features .Case("cxx_access_control_sfinae", LangOpts.CPlusPlus0x) .Case("cxx_alias_templates", LangOpts.CPlusPlus0x) .Case("cxx_alignas", LangOpts.CPlusPlus0x) @@ -672,7 +672,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { .Case("cxx_trailing_return", LangOpts.CPlusPlus0x) .Case("cxx_unicode_literals", LangOpts.CPlusPlus0x) .Case("cxx_unrestricted_unions", LangOpts.CPlusPlus0x) - //.Case("cxx_user_literals", false) + .Case("cxx_user_literals", LangOpts.CPlusPlus0x) .Case("cxx_variadic_templates", LangOpts.CPlusPlus0x) // Type traits .Case("has_nothrow_assign", LangOpts.CPlusPlus) diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp index 40d651dff5..1c045664ce 100644 --- a/test/Lexer/has_feature_cxx0x.cpp +++ b/test/Lexer/has_feature_cxx0x.cpp @@ -244,3 +244,12 @@ int no_unrestricted_unions(); // CHECK-0X: has_unrestricted_unions // CHECK-NO-0X: no_unrestricted_unions + +#if __has_feature(cxx_user_literals) +int has_user_literals(); +#else +int no_user_literals(); +#endif + +// CHECK-0X: has_user_literals +// CHECK-NO-0X: no_user_literals diff --git a/www/cxx_status.html b/www/cxx_status.html index d5405e24c9..fad14f1c0d 100644 --- a/www/cxx_status.html +++ b/www/cxx_status.html @@ -213,7 +213,7 @@ with clang; other versions have not been tested.

User-defined literals N2765 - No + SVN Standard Layout Types