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

    <tr>
        <th>Summary</th>
        <td>
            clang-format attempts to add the lines of code after macro definition to the macro
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          jacob-abraham
      </td>
    </tr>
</table>

<pre>
    I have a macro definition, followed by an include statement. Below is what it should look like.

```c
#define CUSTOM(name)                                                           \
    case i64_##name: return "custom_" #name;
#include "file.inc"
```

If I now run clang-format on it, the formatted code is below.

```
#define CUSTOM(name)                                                           \
    case i64_##name: return "custom_" #name; #include "file.inc"
```

This breaks the meaning of the code.

This is my .clang-format file

```
BreakBeforeBraces: Attach
AlignAfterOpenBracket: AlwaysBreak
SpaceBeforeParens: Never
IndentWidth: 4
ColumnLimit: 80
IndentCaseLabels: true
UseTab: Never
PointerAlignment: Left
IndentPPDirectives: BeforeHash
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: AllIfsAndElse

BinPackArguments: false
AllowAllParametersOfDeclarationOnNextLine: false
BinPackParameters: false
AllowAllArgumentsOnNextLine: false
```

If I removed `AllowShortCaseLabelsOnASingleLine: true`, then it properly does not add the include to the macro. If I do it with any other kind of statement after the macro, it does not add it to the macro definition. If I add any kind of statement after the macro, it works as expected.

This is a stripped-down example that is independent of my code. I have a number of patterns like this in my code and this is the only one that breaks, from what I can tell it is having the case statement inside of a macro with the include statement afterward with no statement after the include statement that causes the bug.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVkuP2zgM_jX2RRjDcR4zOfiQZFo0wGwTIFPscUFbdKxGlgxJTpp_v5Sc5zwWRU8bGJnIJD-SHx-aQvNjvmQ17JEBa6A0mnGshBJOaBVlC1ZpKfUBOSuODBQTqpQdR2YdOGxQ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