[PATCH] D33029: [clang-format] add option for dangling parenthesis
Jake Harr via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 23 09:43:51 PDT 2021
jakar added a comment.
@catskul can you share your changes somehow? If you did, sorry, I'm new to Phabricator.
Before I saw @catskul's comment, I rebased @stringham's diff and got the existing unit tests to work. But after some experimentation, I found that it didn't always behave like I expected. It would sometimes do things like this:
someFunction(anotherLongFunctionName(arg1, arg2, "this is a description")
);
void SomeClass::someMemberFunction(const std::string& whatever, int blah
) const {
}
I think it should only break before closing when the matching opening was followed by a new line (with possible whitespace or comment).
And it also didn't handle brace-initialized vars consistently:
LongClassName longVarName1(
somethingElseThatIsLong(arg1, arg2, arg3, arg4),
anotherLongVarName
);
LongClassName longVarName2{
somethingElseThatIsLong(arg1, arg2, arg3, arg4),
anotherLongVarName};
So I think there is still a bit of work here to be done. And unit tests could definitely help.
I can take my best stab at this, when I get time, but I'm honestly not familiar with any of it. Any suggestions would be great. Please let me know how I can help.
Anyhow, I'm excited about this feature, mostly because I find it more readable, but also because it allows consistency with other languages, like Python (see PEP8):
my_list = [
1, 2, 3,
4, 5, 6,
]
result = some_function_that_takes_arguments(
'a', 'b', 'c',
'd', 'e', 'f',
)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D33029/new/
https://reviews.llvm.org/D33029
More information about the cfe-commits
mailing list