[PATCH] D131985: clang-tidy: strip useless parens from `return` statements
Oleg Smolsky via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 16 16:33:36 PDT 2022
oleg.smolsky marked 3 inline comments as done.
oleg.smolsky added a comment.
In D131985#3727568 <https://reviews.llvm.org/D131985#3727568>, @Eugene.Zelenko wrote:
> In D131985#3727544 <https://reviews.llvm.org/D131985#3727544>, @oleg.smolsky wrote:
>
>> In D131985#3727436 <https://reviews.llvm.org/D131985#3727436>, @njames93 wrote:
>>
>>> The idea of this check is good, but restricting it to only return statements seems baffling. A general check that could remove useless parens would have a lot more value.
>>
>> Of course a more general check would be more generally useful. Yet that requires a lot more code as handling many more contexts in involved in C++.
>>
>> Basically this change addresses a concrete, somewhat wide-spread silly habit that exists in the wild.
>
> I recently observed in the wild patterns like:
>
> std::vector<std::string> data;
>
> for (std::vector<std::string>::iterator it = data.begin(); it != data.end(); ++it)
> std::cout << (*it) << std::endl;
While I have not seen that one, I've seen something similar, with even more involved syntax:
for (auto it = data.begin(); it != data.end(); ++it)
std::cout << (*it).something << std::endl;
people write wild syntax...
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131985/new/
https://reviews.llvm.org/D131985
More information about the cfe-commits
mailing list