Details
Diff Detail
Event Timeline
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
42 | Please add a comment about when this happens (template parameter packs? C-style variadic functions?). | |
47 | Please add an empty line before the comment. | |
49 | nit: Add three spaces before the first word for better alignment. | |
59 | s/making this a reference/making it a reference/? | |
63 | 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 | ||
7 | Add an example? | |
17 | nit: a ; seems to be more suitable as a trailing punctuation here. |
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
25–32 | How about return (Name.empty() ? llvm::Twine('#') + (Index + 1) : llvm::Twine('\'') + Name + '\'').str(); or something like this? | |
42 | Can you first try adding tests with template parameter packs and C-style variadic functions? | |
56 | 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 | Ran over large corpus and the check is not needed. Removed. | |
56 | Code is gone. Was not needed. | |
test/clang-tidy/performance-unnecessary-value-param.cpp | ||
52 | Good point. Added. |
Looks good! Thank you!
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
27 | nit: IIUC, there's no need for explicit llvm::Twine around the second '\'' in this line. |
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
27 | Twine only has an implicit constructor for const char* but not for char. I can either leave it as is or switch to "'". |
nit: IIUC, there's no need for explicit llvm::Twine around the second '\'' in this line.