Where can I enable Resharper C++ suggestion to pass parameters as const references?
Where can I enable Resharper C++ suggestion to pass parameters as const references? I remember it was recommending me to make parameters const and then pass by reference when applicable, and it was useful in many cases, but now it doesn't do it.
I think it was something like
clang-pass-by-reference
inspection with parameter may be made const
inspection.The const inspection is still there but I can't find inspection for the pass-by-reference.
I reset my settings to default just to make sure it's something I didn't turn off myself.
Please sign in to leave a comment.
Probably performance-unnecessary-value-param (https://clang.llvm.org/extra/clang-tidy/checks/performance-unnecessary-value-param.html)
ReSharper 2021.2 will have a built-in inspection for this.
Thanks.
Yes, that was it.
Apparently, after I reset all of my settings to default, I was checking if it was making that suggestion on types which were trivial to copy. It still doesn't suggest it on the types I was trying it on.
I then tried it on a newly created project with all default settings and std::string passed as a function parameter and it did suggest the `performance-unnecessary-value-param` fix for it. After I disabled the inspection, it stopped suggesting it for the std::string on the test project, as expected.
After I restored my backed up settings in Resharper, I went to check if the `performance-unnecessary-value-param` was disabled. It was enabled, and it still didn't suggest the fix for even std::string. I reset my inspection settings to default and that, it finally started suggesting the `performance-unnecessary-value-param` for types like std::string.
It works as expected now.
I think it might be a bug somewhere because inspection settings were enabled and it still wasn't suggesting the fix. Well, reset inspection settings fixes it, if anyone ever runs into it.
Maybe you disabled clang-tidy support? Can you share your saved settings?
Yes, you are right, I did have clang disabled: