[PATCH] D36019: [clang-format] Fix bug with ENAS_DontAlign and empty lines

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 6 22:18:38 PDT 2017


djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Thanks you.



================
Comment at: lib/Format/WhitespaceManager.cpp:650
+    for (unsigned i = 0; i < Newlines; ++i)
+      Text.append(UseCRLF ? " \\\r\n" : " \\\n");
+    return;
----------------
jtbandes wrote:
> djasper wrote:
> > Note that when you have an empty line, this would turn into:
> > 
> >   #define A \
> >     int i; \
> >    \                <-- Note the 1-space indent here.
> >     int j; \
> >     int k;
> > 
> > With my alternative below, that "\" will just be put at column 0, which probably isn't better or worse.
> I suppose that can be changed back to 1 by using `std::max<int>(1, EscapedNewlineColumn - 1);` instead, right? I don't have strong feelings about whether it should be 0 or 1.
I don't either. Leave as is for now.


https://reviews.llvm.org/D36019





More information about the cfe-commits mailing list