This commit improves the fix-its of modernize-pass-by-value by
no longer proposing partial fixes. In the presence of using/typedef,
we failed to rewrite the function signature but still adjusted the
function body. This led to incorrect, partial fix-its. Instead, the
check now simply doesn't offer any fixes at all in such a situation
Details
- Reviewers
alexfh aaron.ballman whisperity hokein
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
not sure whom to add as a reviewer. According to git log this check wasn't changed for a while...
Adding @alexfh based on CODE_OWNERS.TXT
@ymandel, @whisperity, @aaron.ballman could one of you review this/point me in the direction of a good reviewer for this change?
(Sorry for the spam - I am new to the LLVM project, and I guess I still have to learn how to navigate Phabricator/find the correct reviewers for my changes)
No worries; this is not spam, it was super handy for raising awareness!
I've added a few more reviewers who can hopefully help. I'll try to take a look once I get the chance, but I'm pretty swamped currently with C standards meetings this week. Also, the LLVM dev conference is this week, so reviewers may be hard to come by. Thank you for your patience though!
Thanks for your patience!
clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp | ||
---|---|---|
198 | Please spell out this type (per our usual coding conventions). The use on the next line is fine because the type name is spelled out in the initialization. | |
211–221 | I don't think we should take these changes, unless they're strictly necessary for program correctness. The rule of thumb in clang-tidy for fix-its is that we do not make much attempt to have pretty formatting from the fix (the fix needs to be correct, but doesn't need to be formatted); the user can run clang-format after applying fixes. Someday, we'd like to consume clang-format as a library and automatically reformat the code after applying fixes instead of trying to catch every formatting concern in each individual check. | |
212–216 | Please spell out the types. | |
218–220 | (Style guideline nit) |
Address review comments
clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp | ||
---|---|---|
198 | Thanks for the hint. I wasn't aware of that convention. I fixed it here. Should I also fix the other violations in this file? E.g., a couple of lines above, we have auto Diag = diag(ParamDecl->getBeginLoc(), "pass by value and use std::move"); which I guess should be clang::DiagnosticBuilder Diag = diag(ParamDecl->getBeginLoc(), "pass by value and use std::move"); | |
211–221 | sounds good. Removed the whitespace related parts from this patch | |
212–216 | no longer applicable after removing the whitespace related part of this patch | |
218–220 | no longer applicable after removing the whitespace related part of this patch |
LGTM aside from a small commenting nit.
clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp | ||
---|---|---|
194 | ||
198 |
No problem! In case you haven't seen it, we document our coding style here: https://llvm.org/docs/CodingStandards.html
If you want to, you can do it as an NFC change separate from these changes, but I certainly don't insist. |
OMG, I'm sorry for missing this note! Yes, I'm happy to commit on your behalf. What name and email address would you like me to use for patch attribution?
What name and email address would you like me to use for patch attribution?
Adrian Vogelsgesang, avogelsgesang@salesforce.com
Thanks for the fix and your patience with getting it landed! I've commit on your behalf in 5d3b8956e83484ff7234dda5e939abbdc9bd2c88