<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-format: Add option to enforce separation line between method definitions"
href="https://bugs.llvm.org/show_bug.cgi?id=46550">46550</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format: Add option to enforce separation line between method definitions
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rverschelde@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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
(<a href="https://github.com/godotengine/godot">https://github.com/godotengine/godot</a>) 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].</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>