mprobst added inline comments.
================
Comment at: lib/Format/Format.cpp:858
@@ +857,3 @@
+ }
+ if (Prev) {
+ if (Prev->isOneOf(tok::plus, tok::plusplus, tok::minus,
----------------
djasper wrote:
> I'd probably put this into the other two conditions to reduce indentation.
> More specifically, I'd do:
>
> if (PrecedesOperand(Prev)) // sink the nullptr check into the function.
> return;
>
> if (Prev->isOneOf(...)) {
> }
Not having a `Prev` is actually part of the `true` case (no token/start of file
precedes an operand), i.e. if nothing precedes the slash, it must be a regexp,
too. Given that, both of the nested checks only run `if (Prev)`, so I think the
nesting makes sense.
However it turns out my unary check was slightly off and untested (whoops).
Added a test and fixed the code.
http://reviews.llvm.org/D13765
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits