Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Continuation of long lines aligns with start of line instead of start of instruction #46066

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR47097
Status NEW
Importance P normal
Reported by Waris Boonyasiriwat (waris.boonyasiriwat@gmail.com)
Reported on 2020-08-10 12:27:17 -0700
Last modified on 2020-08-10 12:30:17 -0700
Version 10.0
Hardware PC Linux
CC djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org, waris.boonyasiriwat@gmail.com
Fixed by commit(s)
Attachments bugreport.zip (2930 bytes, application/zip)
Blocks
Blocked by
See also
Created attachment 23838
3 files: (1) the dummy test file (2) .clang-format for v10 (3) .clang-format
for v6

Version:
clang-format version 10.0.0-4ubuntu1~18.04.2

Overview:
Continuation of long lines seem to align with the start of line instead of
start of instruction. This behaviour did not exist in clang-format-6.0.

Steps to reproduce:
Run clang-format with ColumnLimit of 120 and ContinuationIndentWidth of 2 on
this snippet (also attached).

void foo()
{
    if (SUCCESS_CONSTANT
        == a_really_really_really_long_function_name(
               reinterpret_cast<uint8_t*>(a_somewhat_long_argument), a_somewhat_long_argument,
               reinterpret_cast<uint16_t*>(a_really_really_really_really_really_long_argument),
               reinterpret_cast<uint32_t*>(a_really_really_really_really_really_long_argument)))
    {
        // do stuff
    }
}

Expected Result (what I got with clang-format-6.0):

void foo()
{
    if (SUCCESS_CONSTANT
        == a_really_really_really_long_function_name(
             reinterpret_cast<uint8_t*>(a_somewhat_long_argument), a_somewhat_long_argument,
             reinterpret_cast<uint16_t*>(a_really_really_really_really_really_long_argument),
             reinterpret_cast<uint32_t*>(a_really_really_really_really_really_long_argument)))
    {
        // do stuff
    }
}

Actual Result (what I got with clang-format-10):

void foo()
{
    if (SUCCESS_CONSTANT
        == a_really_really_really_long_function_name(
          reinterpret_cast<uint8_t*>(a_somewhat_long_argument), a_somewhat_long_argument,
          reinterpret_cast<uint16_t*>(a_really_really_really_really_really_long_argument),
          reinterpret_cast<uint32_t*>(a_really_really_really_really_really_long_argument)))
    {
        // do stuff
    }
}

Notice how the continued line is aligned to the left of the function name. I
tried tweaking many other rules but did not seem to help. This led me to
believe that the alignment reference for long line continuation has been
changed from "start of instruction" to "start of line"
Quuxplusone commented 4 years ago

Attached bugreport.zip (2930 bytes, application/zip): 3 files: (1) the dummy test file (2) .clang-format for v10 (3) .clang-format for v6