[PATCH] D18191: [clang-tidy] Add check for function parameters that are const& to builtin types

Samuel Benzaquen via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 07:44:59 PDT 2016

sbenza added a comment.

As Alex mentioned, we have a test like this.
It also adds a hardcoded list of user-defined types that are known to be better when passed by value (eg. StringRef)

One big difference is that we decided to not trigger on typedefs.
We can't know that the typedef is documented to be trivial and it could change in the future.
The check actually verifies that the spelling is the expected spelling.
That skips things like macros, templates, type traits, typedefs, aliases, etc.

I could upstream that check and make the user-defined type list configurable.


More information about the cfe-commits mailing list