Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
41 ↗ | (On Diff #48636) | Please add a comment about when this happens (template parameter packs? C-style variadic functions?). |
46 ↗ | (On Diff #48636) | Please add an empty line before the comment. |
48 ↗ | (On Diff #48636) | nit: Add three spaces before the first word for better alignment. |
58 ↗ | (On Diff #48636) | s/making this a reference/making it a reference/? |
62 ↗ | (On Diff #48636) | What if parameter doesn't have a name? Should we print an index ("parameter #n is copied ..."). |
docs/clang-tidy/checks/performance-unnecessary-value-param.rst | ||
6 ↗ | (On Diff #48636) | Add an example? |
16 ↗ | (On Diff #48636) | nit: a ; seems to be more suitable as a trailing punctuation here. |
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
25–32 ↗ | (On Diff #49307) | How about return (Name.empty() ? llvm::Twine('#') + (Index + 1) : llvm::Twine('\'') + Name + '\'').str(); or something like this? |
42 ↗ | (On Diff #49307) | Can you first try adding tests with template parameter packs and C-style variadic functions? |
56 ↗ | (On Diff #49307) | nit: No braces around single-line if bodies. |
After testing the check against a large corpus I was able to remove the unnecessary param index check. But I discovered that the check crashed on value arguments of deleted assignment operators due to the lack of a function body. I added a test case and added a guard to address this.
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
42 ↗ | (On Diff #49307) | Ran over large corpus and the check is not needed. Removed. |
56 ↗ | (On Diff #49307) | Code is gone. Was not needed. |
test/clang-tidy/performance-unnecessary-value-param.cpp | ||
52 ↗ | (On Diff #49307) | Good point. Added. |
Looks good! Thank you!
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
26 ↗ | (On Diff #51385) | nit: IIUC, there's no need for explicit llvm::Twine around the second '\'' in this line. |
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
26 ↗ | (On Diff #51385) | Twine only has an implicit constructor for const char* but not for char. I can either leave it as is or switch to "'". |