clang-format: Improve handling of comments in binary expressions.
Before:
b = a &&
// Comment
b.c &&
d;
After:
b = a &&
// Comment
b.c && d;
This fixes llvm.org/PR21535.
llvm-svn: 221727
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 715cbf0..8ec8f58 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1149,8 +1149,7 @@
Current->OperatorIndex = OperatorIndex;
++OperatorIndex;
}
-
- next(/*SkipPastLeadingComments=*/false);
+ next(/*SkipPastLeadingComments=*/Precedence > 0);
}
}
}