[llvm-bugs] [Bug 43237] New: Indentation of nested scopes is incorrect

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 6 04:37:32 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: jan.valiska at fpt.sk
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190906/4e3c8441/attachment.html>


More information about the llvm-bugs mailing list