Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-format incorrectly expands short method to be multiple lines in presence of macros #54901

Closed
aeubanks opened this issue Apr 13, 2022 · 3 comments

Comments

@aeubanks
Copy link
Contributor

$ cat .clang-format
AllowShortFunctionsOnASingleLine: Inline
$ cat a.h
struct A {
#ifdef A
  void f() { a(); }
#endif
};
$ clang-format
struct A {
#ifdef A
  void f() {
    a();
  }
#endif
};
@llvmbot
Copy link
Member

llvmbot commented Apr 13, 2022

@llvm/issue-subscribers-clang-format

@aeubanks
Copy link
Contributor Author

Regressed by https://reviews.llvm.org/D117142

@aeubanks
Copy link
Contributor Author

Potential fix: https://reviews.llvm.org/D123737

@mkurdej mkurdej added the awaiting-review Has pending Phabricator review label Apr 14, 2022
@github-actions github-actions bot removed the awaiting-review Has pending Phabricator review label Apr 14, 2022
akien-mga added a commit to akien-mga/godot that referenced this issue Aug 3, 2022
We use 'All' which is the default in the base LLVM style.

That's not the style we want but it works around the upstream
regression until clang-format 15.0 is released and widely used:
llvm/llvm-project#54901
akien-mga added a commit to godotengine/godot that referenced this issue Aug 3, 2022
We use 'All' which is the default in the base LLVM style.

That's not the style we want but it works around the upstream
regression until clang-format 15.0 is released and widely used:
llvm/llvm-project#54901

(cherry picked from commit 11ec709)
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
With D117142, we would now format

```
struct A {
#define A
  void f() { a(); }
#endif
};
```

into

```
struct A {
#ifdef A
  void f() {
    a();
  }
#endif
};
```

because we were looking for the record lbrace without skipping preprocess lines.

Fixes llvm/llvm-project#54901.

Reviewed By: curdeius, owenpan

Differential Revision: https://reviews.llvm.org/D123737
Riordan-DC pushed a commit to Riordan-DC/godot that referenced this issue Jan 24, 2023
We use 'All' which is the default in the base LLVM style.

That's not the style we want but it works around the upstream
regression until clang-format 15.0 is released and widely used:
llvm/llvm-project#54901

(cherry picked from commit 11ec709)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants