<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Indentation of nested scopes is incorrect"
   href="https://bugs.llvm.org/show_bug.cgi?id=43237">43237</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Indentation of nested scopes is incorrect
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jan.valiska@fpt.sk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 <a href="https://zed0.co.uk/clang-format-configurator/">https://zed0.co.uk/clang-format-configurator/</a>)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>