Re: r331244 - Implement P0482R2, support for char8_t type.

2018-05-01 Thread Richard Smith via cfe-commits
On 1 May 2018 at 08:55, David Majnemer via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Mon, Apr 30, 2018 at 10:02 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Mon Apr 30 22:02:45 2018
>> New Revision: 331244
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=331244=rev
>> Log:
>> Implement P0482R2, support for char8_t type.
>>
>> This is not yet part of any C++ working draft, and so is controlled by
>> the flag
>> -fchar8_t rather than a -std= flag. (The GCC implementation is controlled
>> by a
>> flag with the same name.)
>>
>> This implementation is experimental, and will be removed or revised
>> substantially to match the proposal as it makes its way through the C++
>> committee.
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/char8_t.cpp
>> cfe/trunk/test/Lexer/char8_t.cpp
>> cfe/trunk/test/SemaCXX/char8_t.cpp
>> Modified:
>> cfe/trunk/include/clang/AST/ASTContext.h
>> cfe/trunk/include/clang/AST/BuiltinTypes.def
>> cfe/trunk/include/clang/AST/Type.h
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/include/clang/Basic/LangOptions.def
>> cfe/trunk/include/clang/Basic/Specifiers.h
>> cfe/trunk/include/clang/Basic/TokenKinds.def
>> cfe/trunk/include/clang/Driver/Options.td
>> cfe/trunk/include/clang/Sema/DeclSpec.h
>> cfe/trunk/include/clang/Sema/Initialization.h
>> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>> cfe/trunk/lib/AST/ASTContext.cpp
>> cfe/trunk/lib/AST/ExprConstant.cpp
>> cfe/trunk/lib/AST/ItaniumMangle.cpp
>> cfe/trunk/lib/AST/MicrosoftMangle.cpp
>> cfe/trunk/lib/AST/NSAPI.cpp
>> cfe/trunk/lib/AST/Type.cpp
>> cfe/trunk/lib/AST/TypeLoc.cpp
>> cfe/trunk/lib/Analysis/PrintfFormatString.cpp
>> cfe/trunk/lib/Basic/IdentifierTable.cpp
>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
>> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>> cfe/trunk/lib/Format/FormatToken.cpp
>> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>> cfe/trunk/lib/Index/USRGeneration.cpp
>> cfe/trunk/lib/Lex/PPExpressions.cpp
>> cfe/trunk/lib/Parse/ParseDecl.cpp
>> cfe/trunk/lib/Parse/ParseExpr.cpp
>> cfe/trunk/lib/Parse/ParseExprCXX.cpp
>> cfe/trunk/lib/Parse/ParseTentative.cpp
>> cfe/trunk/lib/Sema/DeclSpec.cpp
>> cfe/trunk/lib/Sema/SemaDecl.cpp
>> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>> cfe/trunk/lib/Sema/SemaExpr.cpp
>> cfe/trunk/lib/Sema/SemaInit.cpp
>> cfe/trunk/lib/Sema/SemaOverload.cpp
>> cfe/trunk/lib/Sema/SemaTemplate.cpp
>> cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
>> cfe/trunk/lib/Sema/SemaType.cpp
>> cfe/trunk/lib/Serialization/ASTCommon.cpp
>> cfe/trunk/lib/Serialization/ASTReader.cpp
>> cfe/trunk/test/Lexer/cxx-features.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/ASTContext.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/
>> AST/ASTContext.h?rev=331244=331243=331244=diff
>> 
>> ==
>> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
>> +++ cfe/trunk/include/clang/AST/ASTContext.h Mon Apr 30 22:02:45 2018
>> @@ -999,6 +999,7 @@ public:
>>CanQualType WCharTy;  // [C++ 3.9.1p5].
>>CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
>>CanQualType WIntTy;   // [C99 7.24.1], integer type unchanged by
>> default promotions.
>> +  CanQualType Char8Ty;  // [C++20 proposal]
>>CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
>>CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
>>CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty;
>>
>> Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/
>> AST/BuiltinTypes.def?rev=331244=331243=331244=diff
>> 
>> ==
>> --- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
>> +++ cfe/trunk/include/clang/AST/BuiltinTypes.def Mon Apr 30 22:02:45 2018
>> @@ -72,6 +72,9 @@ UNSIGNED_TYPE(UChar, UnsignedCharTy)
>>  // 'wchar_t' for targets where it's unsigned
>>  SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
>>
>> +// 'char8_t' in C++20 (proposed)
>> +UNSIGNED_TYPE(Char8, Char8Ty)
>> +
>>  // 'char16_t' in C++
>>  UNSIGNED_TYPE(Char16, Char16Ty)
>>
>>
>> Modified: cfe/trunk/include/clang/AST/Type.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/
>> AST/Type.h?rev=331244=331243=331244=diff
>> 
>> ==
>> --- cfe/trunk/include/clang/AST/Type.h (original)
>> +++ cfe/trunk/include/clang/AST/Type.h Mon Apr 30 22:02:45 2018
>> @@ -1777,6 +1777,7 @@ public:
>>  

Re: r331244 - Implement P0482R2, support for char8_t type.

2018-05-01 Thread David Majnemer via cfe-commits
On Mon, Apr 30, 2018 at 10:02 PM, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Mon Apr 30 22:02:45 2018
> New Revision: 331244
>
> URL: http://llvm.org/viewvc/llvm-project?rev=331244=rev
> Log:
> Implement P0482R2, support for char8_t type.
>
> This is not yet part of any C++ working draft, and so is controlled by the
> flag
> -fchar8_t rather than a -std= flag. (The GCC implementation is controlled
> by a
> flag with the same name.)
>
> This implementation is experimental, and will be removed or revised
> substantially to match the proposal as it makes its way through the C++
> committee.
>
> Added:
> cfe/trunk/test/CodeGenCXX/char8_t.cpp
> cfe/trunk/test/Lexer/char8_t.cpp
> cfe/trunk/test/SemaCXX/char8_t.cpp
> Modified:
> cfe/trunk/include/clang/AST/ASTContext.h
> cfe/trunk/include/clang/AST/BuiltinTypes.def
> cfe/trunk/include/clang/AST/Type.h
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Basic/Specifiers.h
> cfe/trunk/include/clang/Basic/TokenKinds.def
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/include/clang/Sema/DeclSpec.h
> cfe/trunk/include/clang/Sema/Initialization.h
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/lib/AST/ASTContext.cpp
> cfe/trunk/lib/AST/ExprConstant.cpp
> cfe/trunk/lib/AST/ItaniumMangle.cpp
> cfe/trunk/lib/AST/MicrosoftMangle.cpp
> cfe/trunk/lib/AST/NSAPI.cpp
> cfe/trunk/lib/AST/Type.cpp
> cfe/trunk/lib/AST/TypeLoc.cpp
> cfe/trunk/lib/Analysis/PrintfFormatString.cpp
> cfe/trunk/lib/Basic/IdentifierTable.cpp
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> cfe/trunk/lib/Format/FormatToken.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/lib/Index/USRGeneration.cpp
> cfe/trunk/lib/Lex/PPExpressions.cpp
> cfe/trunk/lib/Parse/ParseDecl.cpp
> cfe/trunk/lib/Parse/ParseExpr.cpp
> cfe/trunk/lib/Parse/ParseExprCXX.cpp
> cfe/trunk/lib/Parse/ParseTentative.cpp
> cfe/trunk/lib/Sema/DeclSpec.cpp
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/lib/Sema/SemaInit.cpp
> cfe/trunk/lib/Sema/SemaOverload.cpp
> cfe/trunk/lib/Sema/SemaTemplate.cpp
> cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
> cfe/trunk/lib/Sema/SemaType.cpp
> cfe/trunk/lib/Serialization/ASTCommon.cpp
> cfe/trunk/lib/Serialization/ASTReader.cpp
> cfe/trunk/test/Lexer/cxx-features.cpp
>
> Modified: cfe/trunk/include/clang/AST/ASTContext.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/AST/ASTContext.h?rev=331244=331243=331244=diff
> 
> ==
> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
> +++ cfe/trunk/include/clang/AST/ASTContext.h Mon Apr 30 22:02:45 2018
> @@ -999,6 +999,7 @@ public:
>CanQualType WCharTy;  // [C++ 3.9.1p5].
>CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
>CanQualType WIntTy;   // [C99 7.24.1], integer type unchanged by
> default promotions.
> +  CanQualType Char8Ty;  // [C++20 proposal]
>CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
>CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
>CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty;
>
> Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/AST/BuiltinTypes.def?rev=331244=331243=331244=diff
> 
> ==
> --- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
> +++ cfe/trunk/include/clang/AST/BuiltinTypes.def Mon Apr 30 22:02:45 2018
> @@ -72,6 +72,9 @@ UNSIGNED_TYPE(UChar, UnsignedCharTy)
>  // 'wchar_t' for targets where it's unsigned
>  SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
>
> +// 'char8_t' in C++20 (proposed)
> +UNSIGNED_TYPE(Char8, Char8Ty)
> +
>  // 'char16_t' in C++
>  UNSIGNED_TYPE(Char16, Char16Ty)
>
>
> Modified: cfe/trunk/include/clang/AST/Type.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/AST/Type.h?rev=331244=331243=331244=diff
> 
> ==
> --- cfe/trunk/include/clang/AST/Type.h (original)
> +++ cfe/trunk/include/clang/AST/Type.h Mon Apr 30 22:02:45 2018
> @@ -1777,6 +1777,7 @@ public:
>bool isBooleanType() const;
>bool isCharType() const;
>bool isWideCharType() const;
> +  bool isChar8Type() const;
>bool isChar16Type() const;
>bool isChar32Type() const;
>bool 

Re: r331244 - Implement P0482R2, support for char8_t type.

2018-05-01 Thread Richard Smith via cfe-commits
Thanks, looks good.

On Mon, 30 Apr 2018, 23:52 Chandler Carruth via cfe-commits, <
cfe-commits@lists.llvm.org> wrote:

> I adjusted the test case in r331245 - it was failing for me and most of
> the build bots. Please check that I didn't miss anything.
>
> On Mon, Apr 30, 2018 at 10:06 PM Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Mon Apr 30 22:02:45 2018
>> New Revision: 331244
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=331244=rev
>> Log:
>> Implement P0482R2, support for char8_t type.
>>
>> This is not yet part of any C++ working draft, and so is controlled by
>> the flag
>> -fchar8_t rather than a -std= flag. (The GCC implementation is controlled
>> by a
>> flag with the same name.)
>>
>> This implementation is experimental, and will be removed or revised
>> substantially to match the proposal as it makes its way through the C++
>> committee.
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/char8_t.cpp
>> cfe/trunk/test/Lexer/char8_t.cpp
>> cfe/trunk/test/SemaCXX/char8_t.cpp
>> Modified:
>> cfe/trunk/include/clang/AST/ASTContext.h
>> cfe/trunk/include/clang/AST/BuiltinTypes.def
>> cfe/trunk/include/clang/AST/Type.h
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/include/clang/Basic/LangOptions.def
>> cfe/trunk/include/clang/Basic/Specifiers.h
>> cfe/trunk/include/clang/Basic/TokenKinds.def
>> cfe/trunk/include/clang/Driver/Options.td
>> cfe/trunk/include/clang/Sema/DeclSpec.h
>> cfe/trunk/include/clang/Sema/Initialization.h
>> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>> cfe/trunk/lib/AST/ASTContext.cpp
>> cfe/trunk/lib/AST/ExprConstant.cpp
>> cfe/trunk/lib/AST/ItaniumMangle.cpp
>> cfe/trunk/lib/AST/MicrosoftMangle.cpp
>> cfe/trunk/lib/AST/NSAPI.cpp
>> cfe/trunk/lib/AST/Type.cpp
>> cfe/trunk/lib/AST/TypeLoc.cpp
>> cfe/trunk/lib/Analysis/PrintfFormatString.cpp
>> cfe/trunk/lib/Basic/IdentifierTable.cpp
>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
>> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>> cfe/trunk/lib/Format/FormatToken.cpp
>> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>> cfe/trunk/lib/Index/USRGeneration.cpp
>> cfe/trunk/lib/Lex/PPExpressions.cpp
>> cfe/trunk/lib/Parse/ParseDecl.cpp
>> cfe/trunk/lib/Parse/ParseExpr.cpp
>> cfe/trunk/lib/Parse/ParseExprCXX.cpp
>> cfe/trunk/lib/Parse/ParseTentative.cpp
>> cfe/trunk/lib/Sema/DeclSpec.cpp
>> cfe/trunk/lib/Sema/SemaDecl.cpp
>> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>> cfe/trunk/lib/Sema/SemaExpr.cpp
>> cfe/trunk/lib/Sema/SemaInit.cpp
>> cfe/trunk/lib/Sema/SemaOverload.cpp
>> cfe/trunk/lib/Sema/SemaTemplate.cpp
>> cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
>> cfe/trunk/lib/Sema/SemaType.cpp
>> cfe/trunk/lib/Serialization/ASTCommon.cpp
>> cfe/trunk/lib/Serialization/ASTReader.cpp
>> cfe/trunk/test/Lexer/cxx-features.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/ASTContext.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=331244=331243=331244=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
>> +++ cfe/trunk/include/clang/AST/ASTContext.h Mon Apr 30 22:02:45 2018
>> @@ -999,6 +999,7 @@ public:
>>CanQualType WCharTy;  // [C++ 3.9.1p5].
>>CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
>>CanQualType WIntTy;   // [C99 7.24.1], integer type unchanged by
>> default promotions.
>> +  CanQualType Char8Ty;  // [C++20 proposal]
>>CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
>>CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
>>CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty;
>>
>> Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=331244=331243=331244=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
>> +++ cfe/trunk/include/clang/AST/BuiltinTypes.def Mon Apr 30 22:02:45 2018
>> @@ -72,6 +72,9 @@ UNSIGNED_TYPE(UChar, UnsignedCharTy)
>>  // 'wchar_t' for targets where it's unsigned
>>  SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
>>
>> +// 'char8_t' in C++20 (proposed)
>> +UNSIGNED_TYPE(Char8, Char8Ty)
>> +
>>  // 'char16_t' in C++
>>  UNSIGNED_TYPE(Char16, Char16Ty)
>>
>>
>> Modified: cfe/trunk/include/clang/AST/Type.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=331244=331243=331244=diff
>>
>> ==

Re: r331244 - Implement P0482R2, support for char8_t type.

2018-05-01 Thread Chandler Carruth via cfe-commits
I adjusted the test case in r331245 - it was failing for me and most of the
build bots. Please check that I didn't miss anything.

On Mon, Apr 30, 2018 at 10:06 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Mon Apr 30 22:02:45 2018
> New Revision: 331244
>
> URL: http://llvm.org/viewvc/llvm-project?rev=331244=rev
> Log:
> Implement P0482R2, support for char8_t type.
>
> This is not yet part of any C++ working draft, and so is controlled by the
> flag
> -fchar8_t rather than a -std= flag. (The GCC implementation is controlled
> by a
> flag with the same name.)
>
> This implementation is experimental, and will be removed or revised
> substantially to match the proposal as it makes its way through the C++
> committee.
>
> Added:
> cfe/trunk/test/CodeGenCXX/char8_t.cpp
> cfe/trunk/test/Lexer/char8_t.cpp
> cfe/trunk/test/SemaCXX/char8_t.cpp
> Modified:
> cfe/trunk/include/clang/AST/ASTContext.h
> cfe/trunk/include/clang/AST/BuiltinTypes.def
> cfe/trunk/include/clang/AST/Type.h
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Basic/Specifiers.h
> cfe/trunk/include/clang/Basic/TokenKinds.def
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/include/clang/Sema/DeclSpec.h
> cfe/trunk/include/clang/Sema/Initialization.h
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/lib/AST/ASTContext.cpp
> cfe/trunk/lib/AST/ExprConstant.cpp
> cfe/trunk/lib/AST/ItaniumMangle.cpp
> cfe/trunk/lib/AST/MicrosoftMangle.cpp
> cfe/trunk/lib/AST/NSAPI.cpp
> cfe/trunk/lib/AST/Type.cpp
> cfe/trunk/lib/AST/TypeLoc.cpp
> cfe/trunk/lib/Analysis/PrintfFormatString.cpp
> cfe/trunk/lib/Basic/IdentifierTable.cpp
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> cfe/trunk/lib/Format/FormatToken.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/lib/Index/USRGeneration.cpp
> cfe/trunk/lib/Lex/PPExpressions.cpp
> cfe/trunk/lib/Parse/ParseDecl.cpp
> cfe/trunk/lib/Parse/ParseExpr.cpp
> cfe/trunk/lib/Parse/ParseExprCXX.cpp
> cfe/trunk/lib/Parse/ParseTentative.cpp
> cfe/trunk/lib/Sema/DeclSpec.cpp
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/lib/Sema/SemaInit.cpp
> cfe/trunk/lib/Sema/SemaOverload.cpp
> cfe/trunk/lib/Sema/SemaTemplate.cpp
> cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
> cfe/trunk/lib/Sema/SemaType.cpp
> cfe/trunk/lib/Serialization/ASTCommon.cpp
> cfe/trunk/lib/Serialization/ASTReader.cpp
> cfe/trunk/test/Lexer/cxx-features.cpp
>
> Modified: cfe/trunk/include/clang/AST/ASTContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=331244=331243=331244=diff
>
> ==
> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
> +++ cfe/trunk/include/clang/AST/ASTContext.h Mon Apr 30 22:02:45 2018
> @@ -999,6 +999,7 @@ public:
>CanQualType WCharTy;  // [C++ 3.9.1p5].
>CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
>CanQualType WIntTy;   // [C99 7.24.1], integer type unchanged by
> default promotions.
> +  CanQualType Char8Ty;  // [C++20 proposal]
>CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
>CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
>CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty;
>
> Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=331244=331243=331244=diff
>
> ==
> --- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
> +++ cfe/trunk/include/clang/AST/BuiltinTypes.def Mon Apr 30 22:02:45 2018
> @@ -72,6 +72,9 @@ UNSIGNED_TYPE(UChar, UnsignedCharTy)
>  // 'wchar_t' for targets where it's unsigned
>  SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
>
> +// 'char8_t' in C++20 (proposed)
> +UNSIGNED_TYPE(Char8, Char8Ty)
> +
>  // 'char16_t' in C++
>  UNSIGNED_TYPE(Char16, Char16Ty)
>
>
> Modified: cfe/trunk/include/clang/AST/Type.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=331244=331243=331244=diff
>
> ==
> --- cfe/trunk/include/clang/AST/Type.h (original)
> +++ cfe/trunk/include/clang/AST/Type.h Mon Apr 30 22:02:45 2018
> @@ -1777,6 +1777,7 @@ public:
>bool isBooleanType() const;
>bool isCharType() const;
>bool isWideCharType() 

r331244 - Implement P0482R2, support for char8_t type.

2018-04-30 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Apr 30 22:02:45 2018
New Revision: 331244

URL: http://llvm.org/viewvc/llvm-project?rev=331244=rev
Log:
Implement P0482R2, support for char8_t type.

This is not yet part of any C++ working draft, and so is controlled by the flag
-fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a
flag with the same name.)

This implementation is experimental, and will be removed or revised
substantially to match the proposal as it makes its way through the C++
committee.

Added:
cfe/trunk/test/CodeGenCXX/char8_t.cpp
cfe/trunk/test/Lexer/char8_t.cpp
cfe/trunk/test/SemaCXX/char8_t.cpp
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/BuiltinTypes.def
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Basic/Specifiers.h
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/AST/NSAPI.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/AST/TypeLoc.cpp
cfe/trunk/lib/Analysis/PrintfFormatString.cpp
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Format/FormatToken.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/lib/Lex/PPExpressions.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Lexer/cxx-features.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=331244=331243=331244=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Apr 30 22:02:45 2018
@@ -999,6 +999,7 @@ public:
   CanQualType WCharTy;  // [C++ 3.9.1p5].
   CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
   CanQualType WIntTy;   // [C99 7.24.1], integer type unchanged by default 
promotions.
+  CanQualType Char8Ty;  // [C++20 proposal]
   CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
   CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
   CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty;

Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=331244=331243=331244=diff
==
--- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
+++ cfe/trunk/include/clang/AST/BuiltinTypes.def Mon Apr 30 22:02:45 2018
@@ -72,6 +72,9 @@ UNSIGNED_TYPE(UChar, UnsignedCharTy)
 // 'wchar_t' for targets where it's unsigned
 SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
 
+// 'char8_t' in C++20 (proposed)
+UNSIGNED_TYPE(Char8, Char8Ty)
+
 // 'char16_t' in C++
 UNSIGNED_TYPE(Char16, Char16Ty)
 

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=331244=331243=331244=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Apr 30 22:02:45 2018
@@ -1777,6 +1777,7 @@ public:
   bool isBooleanType() const;
   bool isCharType() const;
   bool isWideCharType() const;
+  bool isChar8Type() const;
   bool isChar16Type() const;
   bool isChar32Type() const;
   bool isAnyCharacterType() const;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=331244=331243=331244=diff
==
---