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

    <tr>
        <th>Summary</th>
        <td>
            clang-format14 Incorrectly formats single line function if there is an ifdef inside class declaration
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          elpixo
      </td>
    </tr>
</table>

<pre>
    With contents of .clang-format
`AllowShortFunctionsOnASingleLine: Inline`

example.cpp
```
#if DEBUG
#endif
class Example1
{
   bool empty() { return true; }
};
```

Both clang-format13 and clang-format14 *correctly* generate
```
#if DEBUG
#endif
struct Example1 {
  bool empty() { return true; }
};
```

BUT

example2.cpp
```
struct Example1
{
#if DEBUG
#endif
   bool empty() { return true; }
};
```

clang-format13 correctly generates;
```
struct Example1 {
#if DEBUG
#endif
  bool empty() { return true; }
};
```

clang-format14 incorrectly generates;
```
struct Example1 {
#if DEBUG
#endif
  bool empty() {
    return true;
  }
};
```

# Versions
clang-format13 version 13.0.1
clang-format14 version 14.0.0


[files.tar.gz](https://github.com/llvm/llvm-project/files/8325304/files.tar.gz)


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVd1vmzAQ_2vg5VQEBgo88ECUdqo0aQ9dt2cDB_Hk2Mg2_dhfvwskLI0StZs6TUK272yffx_SUev2pfwu3AYarRwqZ0F3EDSSq_6q02bLnReuvbDyrsNKSv10v9HG3Y6qcUIr-0VV90L1Ej8LhV5cwZ2Su9V1uL81jfjMt4PEoBmGpdj-m0MWiw7WN6uHT0sCVSu6OSIw1sLNXCTan8hW8wIAaq0l4HZwLx7LPVYAbYJBNxoFzoyEa0Wp9eHimuLzMKZxpXdiHPGPYuCqfZ1KwGNVo43Bxkl6toIeFRru8G8IWkLZuIUhHJH7YG4PX8_4wi4acwLsRPo3WH24MyemLPIv2ttL9y8K_CaFf8ggAaH-G4fFohMyh_z7OdFr8A2N3bWDsz49zpsQxUEYRGeFWI4kdOR19XlMV52QaAPHTdD_9NI1Mdk4N5BaBOCWvp562FgHjd5SIOXjYboajP5BElM4laA5j1kah8khcyjKiuMn_baM2yIuuO-Ek1ieIL47sm5OWrBTJ4RdA4Ru3yGBrHEbNAjCUhuhsMWOjLeiRZgbW4s0k_V02h-NLP-Yl7B2nIilSVIU_qYM-XXBWd0i5mnXcuwy1vI0jIusrpsmRF_yGqUtSVaPMYVPMJWgNSnri5KFjIUxY1GSZAlZgmmed7yI0ixjcZZ7SYhbLmSwwxFo0_umnCDVY29pUwrr7O9N4ih6hTg9R_X56OgfUqIcxLP2p5fLCfkvSxbmDA">