llvm / llvm/llvm-project

[clang-format] macro with code block starting on the define

Open
#168,879 1 comment 0 reactions 0 assignees View on GitHub
clang-format
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

It seems to be impossible (please correct me) to make ``clang-format`` format a macro definition like this:

```c
#define macro { \
int body = 0; \
}
```

No matter what I try, it moves the opening bracket to a new line:
```c
#define macro \
{ \
int body = 0; \
}
```
(One of the variations)

Probably related: https://github.com/llvm/llvm-project/issues/53180

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the macro definition shown in the report and compare clang-format's output with the requested layout. Start by tracing the clang-format handling of macro definitions and brace placement; done means the opening brace can remain on the #define line without disrupting the rest of the block.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.