[clang-format] Support ignoring implicit access modifiers
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Please support ignoring implicit access modifiers. I want to get
```cpp
#pragma once
class ClassA
{
public:
struct type_a_t
{
type1_t a;
type2_t b;
type3_t c;
type4_t d;
// Conversion operator to MCC-generated config struct
explicit operator type_b_t() const
{
return type_b_t{ static_cast(a),
static_cast(b),
static_cast(c),
static_cast(d) };
};
};
};
```
to look like
```cpp
#pragma once
class ClassA
{
public:
struct type_a_t
{
type1_t a;
type2_t b;
type3_t c;
type4_t d;
// Conversion operator to MCC-generated config struct
explicit operator type_b_t() const
{
return type_b_t
{
static_cast(a),
static_cast(b),
static_cast(c),
static_cast(d)
};
}
};
};
```
There are a couple/few separate problems here, but the first is that within the braces for `struct type_a_t`, everything is indented twice because we have `IndentAccessModifiers: true` and there is an implicit access modifier at the start of the struct definition.
Contributor guide
Research direction
Start by tracing clang-format's handling of access-modifier indentation and the existing IndentAccessModifiers option, then add a regression test based on the issue's struct example. Done means implicit access at the start of a struct no longer causes an extra indentation level while explicit access modifiers retain their configured behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100