[clang-format] [feature-request] Add option to autoreplace class -> struct
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
In my company, coding style completely forbids the use of the `class` keyword.
Unfortunately, there is currently no option in clang-format to automatically enforce or transform this rule.
It would be very useful to add an option to clang-format to automatically replace `class` with `struct`
expected behavior:
```cpp
enum class abc ===> enum struct abc
template ===> template
template class A>
void foo();
===>
template typename A>
void foo();
class A ===> struct A
class A : a, b, c ===> struct A : private a, private b, private c
```
Contributor guide
Research direction
Start by examining clang-format and how it handles the class, enum class, and template forms shown in the issue. Define the option's expected behavior from the examples, including access defaults for transformed base classes, and add coverage demonstrating each requested transformation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100