| Issue |
61631
|
| Summary |
clang-format: IndentAccessModifiers causes an extra indent to be added in struct defined inside class declaration
|
| Labels |
|
| Assignees |
|
| Reporter |
cquick01
|
So this might just be me doing something wrong, but it seems like clang-format is adding an extra indent inside my struct
Using `.clang-format`
```
---
BasedOnStyle: LLVM
BreakBeforeBraces: Allman
IndentWidth: 4
IndentAccessModifiers: true
```
I have a class that looks like this
```cpp
// this is my desired formatting
class MyClass
{
public:
MyClass();
~MyClass();
struct MyStruct
{
bool first;
bool second;
};
};
```
And when trying to format with clang-format, it gets formatted like this with an extra indent before each variable within `MyStruct`.
```cpp
class MyClass
{
public:
MyClass();
~MyClass();
struct MyStruct
{
bool first;
bool second;
};
};
```
If I change to
```
---
BasedOnStyle: LLVM
BreakBeforeBraces: Allman
IndentWidth: 4
AccessModifierOffset: -4
IndentAccessModifiers: false
```
it looks a bit better, but I'd rather the access modifier block was indented like the original
```cpp
class MyClass
{
public:
MyClass();
~MyClass();
struct MyStruct
{
bool first;
bool second;
};
};
```
Trying to set both `IndentAccessModifiers: true` and `AccessModifierOffset: -4` still looks like
```cpp
class MyClass
{
public:
MyClass();
~MyClass();
struct MyStruct
{
bool first;
bool second;
};
};
```
Can anyone help fix my configuration to achieve my desired formatting? Thanks in advance.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs