clang-format: Improve indentation of comments in expressions.
Before:
int i = (a)
// comment
+ b;
return aaaa == bbbb
// comment
? aaaa
: bbbb;
After:
int i = (a)
// comment
+ b;
return aaaa == bbbb
// comment
? aaaa
: bbbb;
llvm-svn: 221985
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index b8ab1df..d2e577a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3266,6 +3266,10 @@
" > ccccc) {\n"
"}",
Style);
+ verifyFormat("return (a)\n"
+ " // comment\n"
+ " + b;",
+ Style);
// Forced by comments.
verifyFormat(
@@ -4070,6 +4074,10 @@
" aaaaaaaaa\n"
" ? b\n"
" : c);");
+ verifyFormat("return aaaa == bbbb\n"
+ " // comment\n"
+ " ? aaaa\n"
+ " : bbbb;");
verifyFormat(
"unsigned Indent =\n"
" format(TheLine.First, IndentForLevel[TheLine.Level] >= 0\n"