<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112001>112001</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] "AllowShortFunctionsOnASingleLine: Inline" ignored after preprocessor if block
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jwuttke
</td>
</tr>
</table>
<pre>
My `.clang-format` file has
```
AllowShortFunctionsOnASingleLine: Inline
```
Applied to my C++ code, I get
```
class A {
public:
double f1() const override { return m1; }
#ifdef BLABLA
#endif
double f2() const override
{
return m2;
}
};
```
If I take out the preprocessor _if_ block and rerun clong-format, then I recover the intended formatting
```
class A {
public:
double f1() const override { return m1; }
double f2() const override { return m2; }
};
```
PS. To make this report fully reproducible: my complete `.clang-format` is
```
BasedOnStyle: LLVM
AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AlwaysBreakTemplateDeclarations: MultiLine
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: WebKit
BreakConstructorInitializers : BeforeComma
ColumnLimit: 100
IndentCaseLabels: false
IndentWidth: 4
MaxEmptyLinesToKeep: 2
PointerAlignment: Left
UseTab: Never
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VV1v4jgX_jXm5qgocWhCL3JB4EVCQ9-u1O7O5cixj8FTx47sk3bZX79ySNthijTavViEBOQ8z_l4zgciRnNwiDW7bdjtZiYGOvpQf38diJ5x1np1qu9PwMpsLq1whxvtQyeIlRloYxGOIrJsw7IVK7PpPf5cWetfH48-0HZwkox38cGtHo07WNwbh6xYwc7Z9O0afXLS99agAvLQnWDNeMN4A9IrZHwNOzggXWVLK2KEFbCqOT_oh9YayYrJLwCA8kNrEXTO-JLxO5DeRQL_giEYhYkKAWkIDrqcFQ2wajPF4oXRCjU0-1WzX70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