This is an archive of the discontinued LLVM Phabricator instance.

u8 character literals
ClosedPublic

Authored by aaron.ballman on Jan 7 2016, 10:56 AM.

Details

Reviewers
rsmith
Summary

While working on a different patch, I noticed that pretty-printing of UTF-8 character literals (from C++1z) did not get the proper u8 prefix. This patch tracks the fact that the character literal is UTF-8, even though the underlying character literal type is char. It adds some additional tests to ensure that character literal prefixes are properly tracked for all prefixes.

Diff Detail

Event Timeline

aaron.ballman retitled this revision from to u8 character literals.
aaron.ballman updated this object.
aaron.ballman added a reviewer: rsmith.
aaron.ballman added a subscriber: cfe-commits.
rsmith edited edge metadata.Jan 7 2016, 11:40 AM

Thanks!

You also need to update ASTWriterDecl.cpp's construction of CharacterLiteralAbbrev to allow three bits of Kind rather than two. (You should be able to repro this with a PCH test pretty-printing a U'x' literal.)

lib/Sema/SemaTemplate.cpp
5507

Ascii -> ASCII

Good catches! I've fixed those issues, and commit in r257097 (I thought I had the LG, but now notice I don't -- if this is a problem, I will revert).

rsmith accepted this revision.Jan 7 2016, 2:28 PM
rsmith edited edge metadata.

For posterity :)

This revision is now accepted and ready to land.Jan 7 2016, 2:28 PM
aaron.ballman closed this revision.Jan 7 2016, 2:30 PM

For cleanliness. ;-)