https://bugs.llvm.org/show_bug.cgi?id=50287

            Bug ID: 50287
           Summary: Preprocessor directives force inline functions to
                    unfold
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Steps to Reproduce:
1. Create style with `AllowShortFunctionsOnASingleLine` set to `Inline` or
`All`.
2. Create C++ file with following contents:
```cpp
struct Foo {
#ifdef FOO
#endif
    void foo() {}
};

#ifdef BAR
#endif
void bar() {}
```
3. Format file.

Actual Results:
```cpp
struct Foo {
#ifdef FOO
#endif
    void foo()
    {
    }
};

#ifdef BAR
#endif
void bar()
{
}
```

Expected Results:
```cpp
struct Foo {
#ifdef FOO
#endif
    void foo() {}
};

#ifdef BAR
#endif
void bar() {}
```

Additional Information:
Adding comment line between pp directive and function make clang-format behave
like intended

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to