Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
41 | Please add a comment about when this happens (template parameter packs? C-style variadic functions?). | |
46 | Please add an empty line before the comment. | |
48 | nit: Add three spaces before the first word for better alignment. | |
58 | s/making this a reference/making it a reference/? | |
62 | 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 | Add an example? | |
16 | nit: a ; seems to be more suitable as a trailing punctuation here. |
clang-tidy/performance/UnnecessaryValueParamCheck.cpp | ||
---|---|---|
26–33 | How about return (Name.empty() ? llvm::Twine('#') + (Index + 1) : llvm::Twine('\'') + Name + '\'').str(); or something like this? | |
43 | Can you first try adding tests with template parameter packs and C-style variadic functions? | |
57 | 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 | ||
---|---|---|
43 | Ran over large corpus and the check is not needed. Removed. | |
57 | Code is gone. Was not needed. | |
test/clang-tidy/performance-unnecessary-value-param.cpp | ||
53 | 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.