sammccall added a comment.

IMO this *is* actually a good heuristic: `<<` between string literals indicates 
some intent to break, and when the stream is entirely literals the formatting 
is good.
(@krasimir threw this into our regression testing, and where the formatting was 
different, it was always worse than before).

e.g. before:

  LOG(ERROR) << "(" << foo << ")"
              << " The printer " << bar << " is on fire.";

after:

  LOG(ERROR) << "(" << foo << ")" << " The printer " << bar
             << " is on fire.";

or before:

  LOG_IF(DFATAL, exp_await_calls < num_await_calls_)
      << "Equality condition can never be satisfied:"
      << " exp_await_calls=" << exp_await_calls
      << " num_await_calls_=" << num_await_calls_;

after:

  LOG_IF(DFATAL, exp_await_calls < num_await_calls_)
      << "Equality condition can never be satisfied:" << " exp_await_calls="
      << exp_await_calls << " num_await_calls_=" << num_await_calls_;

However the fact that we can't always infer the intent to break leads to some 
annoying regularities, and it's hard to imagine heuristics could catch every 
case. (I'm thinking about looking at leading/trailing characters in string 
literals, but that's going to be really confusing when it goes wrong).

I guess it's not the end of the world to lose this behavior, but would 
certainly prefer to keep it at least for google style.

(Incidentally, the fact that the google style guide leans towards using 
iostreams mostly only for logging-type stuff might be relevant to the types of 
examples that are typical)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80950/new/

https://reviews.llvm.org/D80950



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to