Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-format improperly formats some string operators #43510

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR44542
Status NEW
Importance P normal
Reported by Denis Nikitin (dnikitin@3redpartners.com)
Reported on 2020-01-14 07:21:42 -0800
Last modified on 2020-06-03 06:29:02 -0700
Version unspecified
Hardware PC Linux
CC jzpigtc4zsi@0box.eu, klimek@google.com, mydeveloperday@gmail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also PR38872
this line

log_error(log_, "from" << "asdf");

(we have some code written which makes it perfectly legal if not nicely looking
c++)

is formatted into this

log_error(log_, "from"
                   << "asdf");

None of the options that look even remotely relevant have any effect. It's
specific to 2 strings, if you replace a string with some other type it doesn't
break the line. Tested on versions from 6 till 9.
Quuxplusone commented 4 years ago

Tested on 10, same

Quuxplusone commented 4 years ago
This is caused by the following in "mustBreakBefore()" which to be honest I
think looks wrong. I don't understand why we MUST break between 2 string
literals.

(I've seen this bug reported before)

  if (Right.is(tok::lessless) && Right.Next &&
      Right.Previous->is(tok::string_literal) &&
      Right.Next->is(tok::string_literal))
    return true;

https://bugs.llvm.org/show_bug.cgi?id=38872
Quuxplusone commented 4 years ago

_Bug 38872 has been marked as a duplicate of this bug._

Quuxplusone commented 4 years ago

we are discussing here https://reviews.llvm.org/D80950