https://bugs.llvm.org/show_bug.cgi?id=43237

            Bug ID: 43237
           Summary: Indentation of nested scopes is incorrect
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Indentation of multiple nested scopes is incorrect. It doesn't matter what are
settings of clang-format. Bad output is produced also with default settings for
all clang-format styles(webkit,llvm,etc...).


Steps to Reproduce:

Create source file with content as:

void fc()
{
// scope1
{ 
// scope2
{
int a;
}
}

// scope3
{
int b;
}
}

When clang-format is applied actual result is:

void fc()
{
    // scope1
    { // scope2
        { int a;
}
}

// scope3
{
    int b;
}
}

Expected result(if parameter IndentLength is 4) is:

void fc()
{
    // scope1
    { 
        // scope2
        {
             int a;
        }
    }

    // scope3
    {
        int b;
    }
}

But if scope3 is removed, indentation of scope1/scope2 is correct.

It seems that it behaves same for all versions of clang-format.
(tested on https://zed0.co.uk/clang-format-configurator/)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to