This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] handle single lines comments ending in `\\`.
ClosedPublic

Authored by mprobst on Aug 1 2017, 10:01 AM.

Details

Summary

Previously, clang-format would consider the following code line to be part of
the comment and incorrectly format the rest of the file.

Diff Detail

Repository
rL LLVM

Event Timeline

mprobst created this revision.Aug 1 2017, 10:01 AM

Friendly ping.

klimek accepted this revision.Aug 8 2017, 12:56 AM

lg

lib/Format/FormatTokenLexer.cpp
544–545 ↗(On Diff #109145)

Just wondering whether the \n can be in the next token. Probably not, though, the way we set up the lexer.

This revision is now accepted and ready to land.Aug 8 2017, 12:56 AM
mprobst marked an inline comment as done.Aug 8 2017, 7:45 AM
mprobst added inline comments.
lib/Format/FormatTokenLexer.cpp
544–545 ↗(On Diff #109145)

AFAIU (and experimentation confirms) LLVM always lexes the \n as separate whitespace from the // ... line comment, but for backslash escaped line endings after the \\ the \n is inside of it - after all it's part of the one comment token that continues on the next line.

This revision was automatically updated to reflect the committed changes.
mprobst marked 2 inline comments as done.