MyDeveloperDay added a comment.

Just to add, I also think although because there are no tests to enforce it the 
primary reason is for when we see '\n', breaking the stream on endl but this is 
actually covered by another rule this also in mustBreak()

  if (Current.is(tok::lessless) &&
      ((Previous.is(tok::identifier) && Previous.TokenText == "endl") ||
       (Previous.Tok.isLiteral() && (Previous.TokenText.endswith("\\n\"") ||
                                     Previous.TokenText == "\'\\n\'"))))
    return true;

Is going to break on what is most likely a natural heuristics where `\n` 
separates different lines

  LOG_IF(DFATAL, a < b) << "Equality condition can never be satisfied:"
                        << " foo=" << a << endl
                        << " is less than "
                        << " bar=" << b;
  
  LOG_IF(DFATAL, a < b) << "Equality condition can never be satisfied:"
                        << " foo=" << a << "\n"
                        << " is less than "
                        << " bar=" << b;

but this is also flawed depending on what precedes the newline

  LOG_IF(DFATAL, a < b) << "Equality condition can never be satisfied:"
                        << " foo=" << a << " and " << endl
                        << " is less than "
                        << " bar=" << b;
  
  LOG_IF(DFATAL, a < b) << "Equality condition can never be satisfied:"
                        << " foo=" << a << " and "
                        << "\n"
                        << " is less than "
                        << " bar=" << b;

I guess these rules were a good first compromise.. and more likely you'd want 
different rules depending on how large the streaming operations.


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