clang-format: Fix indentation relative to unary expressions.
This should be done, only if we are still in the unary expression's
scope.
Before:
bool aaaa = !aaaaaaaa( // break
aaaaaaaaaaa);
*aaaaaa = aaaaaaa( // break
aaaaaaaaaaaaaaaa);
After:
bool aaaa = !aaaaaaaa( // break
aaaaaaaaaaa); // <- (unchanged)
*aaaaaa = aaaaaaa( // break
aaaaaaaaaaaaaaaa); // <- (no longer indented relative to "*")
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189108 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index aec93bb..5606aa1 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -3524,6 +3524,10 @@
"}");
verifyFormat("aaaaaaaaaa(!aaaaaaaaaa( // break\n"
" aaaaa));");
+
+ // Only indent relative to unary operators if the expression is nested.
+ verifyFormat("*aaa = aaaaaaa( // break\n"
+ " bbbbbb);");
}
TEST_F(FormatTest, UndestandsOverloadedOperators) {