<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56901>56901</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-format: extern C includes after system headers with llvm style + regroup enabled
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          0xc0170
      </td>
    </tr>
</table>

<pre>
    Using clang-format, 14.0.6 version. The style defined as:

```
BasedOnStyle : LLVM
AccessModifierOffset: -4
AlignConsecutiveMacros: true
AlignEscapedNewlinesLeft: true
AllowShortFunctionsOnASingleLine: false
AllowShortLoopsOnASingleLine: true
BinPackArguments : false
BinPackParameters : false
BraceWrapping:
  AfterFunction: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
ColumnLimit: 120
IndentCaseLabels: true
IndentWidth: 4
SortIncludes: true
IncludeBlocks: Regroup
TabWidth: 4
```

By enabling sorting includes, I noticed if C++ source code contains extern "C" in the include secion, the extern section comes after system headers. Is this an issue with llvm include style or somewhere in  the clang-format?

Before (`SortIncludes:false`):
```
#include <stdio.h>
#include <string.h>
#include "utest/utest.h"
#include "unity/unity.h"
#include "math.h"

#include "crc_api_tests.h"

extern "C" {
#include "device.h"
#include "crc_api.h"
}
```

After (`SortIncludes:true with Regrouping enabled`)

```
#include "crc_api_tests.h"
#include "math.h"
#include "unity/unity.h"
#include "utest/utest.h"

#include <stdio.h>
#include <string.h>

extern "C" {
#include "crc_api.h"
#include "device.h"
}
```

I would have expected:
```
#include "crc_api_tests.h"
#include "math.h"
#include "unity/unity.h"
#include "utest/utest.h"

extern "C" {
#include "crc_api.h"
#include "device.h"
}

#include <stdio.h>
#include <string.h>
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVl2PmzoQ_TXkxVpEDCGbBx6SbCNFynarbu_tY-WYI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