[PATCH] clang-format: Space and triple angle braces
Daniel Jasper
djasper at google.com
Tue Feb 17 08:47:15 PST 2015
Could you generally upload diffs with the full file as context? That makes review here much easier.
================
Comment at: lib/Format/Format.cpp:665
@@ +664,3 @@
+ // Merge X,less,less,Y into X,lessless,Y unless X or Y is less.
+ if (Tokens.size() < 4)
+ return false;
----------------
Wouldn't we want to fall back to merging in this case?
I think if the user formats the incomplete line "llvm::outs() <<", we should not rip apart the <<. Add a test for this.
================
Comment at: lib/Format/Format.cpp:674
@@ +673,3 @@
+
+ // Check for whitespace between less and less
+ if (First[2]->WhitespaceRange.getBegin() !=
----------------
Make this:
// Only merge if there currently is no whitespace between the two "<".
================
Comment at: lib/Format/Format.cpp:677
@@ +676,3 @@
+ First[2]->WhitespaceRange.getEnd())
+ return false;
+
----------------
Indentation... Maybe use clang-format ;-).
================
Comment at: lib/Format/Format.cpp:679
@@ +678,3 @@
+
+ // Merge X,less,less,Y into X,lessless,Y
+ First[1]->Tok.setKind(tok::lessless);
----------------
I think this comment doesn't add information. Remove.
================
Comment at: lib/Format/TokenAnnotator.cpp:2043
@@ +2042,3 @@
+ if ((Left.is(TT_TemplateOpener) && Right.is(TT_TemplateOpener)) ||
+ (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateCloser)))
+ return false;
----------------
A few lines higher up, there is at test:
if (Left.is(tok::greater) && Right.is(tok::greater) &&
Left.isNot(TT_TemplateCloser))
return false;
Seems like we should combine those. Maybe simply remove the "Left.isNot(TT_TemplateCloser)"?
================
Comment at: lib/Format/TokenAnnotator.cpp:2044
@@ -2042,1 +2043,3 @@
+ (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateCloser)))
+ return false;
if (Left.isBinaryOperator() && !Left.isOneOf(tok::arrowstar, tok::lessless) &&
----------------
Indentation.
http://reviews.llvm.org/D6800
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list