From: Eli Friedman Date: Fri, 14 Sep 2012 00:51:36 +0000 (+0000) Subject: Fix abbreviation for CharacterLiteral in AST serialization. PR13806. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3b6c22401047c18987dd9850e2fb29dd162f44f;p=clang Fix abbreviation for CharacterLiteral in AST serialization. PR13806. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163863 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index baa8a0e4cd..76a2332143 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -1619,7 +1619,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() { //Character Literal Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location - Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //IsWide + Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // getKind CharacterLiteralAbbrev = Stream.EmitAbbrev(Abv); Abv = new BitCodeAbbrev(); diff --git a/test/PCH/cxx_exprs.cpp b/test/PCH/cxx_exprs.cpp index 4cd9bae1fa..01fc33a9a8 100644 --- a/test/PCH/cxx_exprs.cpp +++ b/test/PCH/cxx_exprs.cpp @@ -37,3 +37,9 @@ cxx_null_ptr_result null_ptr = nullptr; // CXXTypeidExpr typeid_result1 typeid_1 = 0; typeid_result2 typeid_2 = 0; + +// CharacterLiteral variants +static_assert(char_value == 97, "char_value is correct"); +static_assert(wchar_t_value == 305, "wchar_t_value is correct"); +static_assert(char16_t_value == 231, "char16_t_value is correct"); +static_assert(char32_t_value == 8706, "char32_t_value is correct"); diff --git a/test/PCH/cxx_exprs.h b/test/PCH/cxx_exprs.h index 67ab4a6d34..35db82efae 100644 --- a/test/PCH/cxx_exprs.h +++ b/test/PCH/cxx_exprs.h @@ -81,3 +81,8 @@ CtorStruct create_CtorStruct() { return CtorStruct(1, 3.14f); // CXXTemporaryObjectExpr }; +// CharacterLiteral variants +const char char_value = 'a'; +const wchar_t wchar_t_value = L'ı'; +const char16_t char16_t_value = u'ç'; +const char32_t char32_t_value = U'∂';