[PATCH] D24257: clang-format: [JS] ignore comments when wrapping returns.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 6 11:46:40 PDT 2016
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.
Comment at: lib/Format/TokenAnnotator.cpp:2384
@@ -2383,2 +2383,3 @@
- if (Left.is(tok::kw_return))
+ const FormatToken *NonComment = Right.getPreviousNonComment();
+ if (Left.isOneOf(tok::kw_return, tok::kw_continue, tok::kw_break,
> Should the entire method generally consider the previous non-comment, instead of just the previous token? Not sure if that makes sense in all cases, and I don't think we always have a previous non-comment token either.
Lets leave this as is for now. Yes, some of these should likely look past comments, but probably not all of them.
More information about the cfe-commits