https://bugs.llvm.org/show_bug.cgi?id=46550
Bug ID: 46550
Summary: clang-format: Add option to enforce separation line
between method definitions
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: rversche...@gmail.com
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
This is a feature request for clang-format.
In C/C++ codebases, some developers (possible some IDEs?) tend to group the
definition of setters and getters together, without having an empty line
separating each definition, e.g.:
```
void some_method() {
// some code
}
void set_some_property(int p_value) {
some_property = p_value;
// do setter stuff
}
int get_some_property() {
return some_property;
}
void some_other_method() {
// some code
}
```
Since this "style" is down to personal preference, it tends not to be upheld
consistently in big codebases, so in my project
(https://github.com/godotengine/godot) we want to enforce having a separation
line between *all* method definitions, whether or not they might be
semantically related, i.e.:
```
void some_method() {
// some code
}
void set_some_property(int p_value) {
some_property = p_value;
// do setter stuff
}
int get_some_property() {
return some_property;
}
void some_other_method() {
// some code
}
```
I would appreciate having a way to enforce this via clang-format instead of
manual review.
I'm not sure what the best name would be for the option, maybe
EnforceSeparationLineBetweenMethodDefinitions?
I don't know if there would be a use case for a flag that would enforce *not*
having a separation line between all method definitions (I don't have any
myself), but if so it could be SeparationLineBetweenMethodDefinitions: [Always,
Never, LeaveAsIs].
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs