| Issue |
87507
|
| Summary |
Macros styling option parses code not like expanded (ignores access modifier offset)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
CDMartinL
|
# Environment
The tested v19 clang-format executable was built from latest source of 13.03.2024. Also tested with clang-format 17.0.3.
Setting in .clang-format is:
```
Language: Cpp
AccessModifierOffset: -2
Macros:
- PUBLIC4UTEST(a)=a
```
# Problem
```
#if COMPILED_FOR_UTEST
#define PUBLIC4UTEST(vis_in_production_code) public
#else
#define PUBLIC4UTEST(vis_in_production_code) vis_in_production_code
#endif
class A {
PUBLIC4UTEST(private):
void method_I_want_to_access_form_unittest();
public:
void other_public_methods();
};
```
formats to
```
#if COMPILED_FOR_UTEST
#define PUBLIC4UTEST(vis_in_production_code) public
#else
#define PUBLIC4UTEST(vis_in_production_code) vis_in_production_code
#endif
class A {
PUBLIC4UTEST(private):
void method_I_want_to_access_form_unittest();
public:
void other_public_methods();
};
```
The `Macros` styling option at least prevents the colon from being moved to a new line, but still does not treat the content in such a way that the indentation is not treated like a method/variable.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs