djasper closed this revision.
djasper added a comment.
Submitted as r302428.
https://reviews.llvm.org/D32733
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jtbandes added a comment.
In https://reviews.llvm.org/D32733#743116, @djasper wrote:
> This is an edge case in actual C++. An escaped newline literally gets
> expanded to nothing. So what this reads is
>
> #define Onetwo \
> ...
Yeah, I noticed that, but nonetheless it shouldn't break the
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.
This is an edge case in actual C++. An escaped newline literally gets expanded
to nothing. So what this reads is
#define Onetwo \
...
https://reviews.llvm.org/D32733
jtbandes marked an inline comment as done.
jtbandes added a comment.
This seems to work fine.
Separately I noticed a strange edge case, which I think is an existing bug:
#define One\
two \
three;
jtbandes updated this revision to Diff 97404.
jtbandes added a comment.
Modified `appendNewlineText` so we can simply `return` in the DontAlign case.
https://reviews.llvm.org/D32733
Files:
include/clang/Format/Format.h
lib/Format/Format.cpp
lib/Format/WhitespaceManager.cpp
jtbandes added inline comments.
Comment at: lib/Format/WhitespaceManager.cpp:523
+ if (C.NewlinesBefore > 0 && C.ContinuesPPDirective)
+C.EscapedNewlineColumn = C.PreviousEndOfTokenColumn + 2;
+return;
djasper wrote:
> I think we should not
djasper added inline comments.
Comment at: lib/Format/WhitespaceManager.cpp:523
+ if (C.NewlinesBefore > 0 && C.ContinuesPPDirective)
+C.EscapedNewlineColumn = C.PreviousEndOfTokenColumn + 2;
+return;
I think we should not duplicate this loop.
jtbandes created this revision.
Herald added a subscriber: klimek.
This converts the clang-format option `AlignEscapedNewlinesLeft` from a boolean
to an enum, named `AlignEscapedNewlines`, with options `Left` (prev. `true`),
`Right` (prev. `false`), and a new option `DontAlign`.
When set to