================
@@ -927,14 +927,12 @@ BreakableLineCommentSection::BreakableLineCommentSection(
       }
 
       if (Lines[i].size() != IndentPrefix.size()) {
-        PrefixSpaceChange[i] = FirstLineSpaceChange;
+        assert(Lines[i].size() > IndentPrefix.size());
 
-        if (SpacesInPrefix + PrefixSpaceChange[i] < Minimum) {
-          PrefixSpaceChange[i] +=
-              Minimum - (SpacesInPrefix + PrefixSpaceChange[i]);
-        }
+        PrefixSpaceChange[i] = SpacesInPrefix + FirstLineSpaceChange < Minimum
----------------
owenca wrote:

Like the examples of [conditional/ternary 
operators](https://en.cppreference.com/w/cpp/language/operator_other.html#Conditional_operator),
 I never add redundant parentheses because they have the lowest precedence 
relative to arithmetic/logical operators. This is analogous to `a + (b * c)` or 
`(a / b) - c`.

The clang-format codebase has a mixture of both `expr1 ? expr2 : expr3` and 
`(expr1) ? expr2 : expr3`, and IMO we should consistently use the former. 
Although I can understand why some people prefer the latter when `expr1` and 
`expr2` are on the same line, there's really nothing to gain when the questions 
mark starts on a new line:
```
expr1
    ? expr2
```

https://github.com/llvm/llvm-project/pull/148324
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to