Open Quuxplusone opened 8 years ago
Clang-tidy already has readability-redundant-string-init check which work for STL strings. Will be good idea to expand it instead iof introducing new one.
This isn't the same thing, because we are checking for more things than just constructing an object.
A similar check could be created for std::string::operator== vs std::string::compare
Oops, ignore my last comment, it was intended for another bug.
wxWidgets has a preconstructed empty string object wxEmptyString of type wxString.
This should be preferred over wxT("") as this constructs an anonymously named temporary of type wxString wherever wxEmptyString could be used instead.
Particularly for default values of functions taking references to const wxString, this can save creating and destroying anonymous temporaries for every function call.
There are probably other wxWidgets idioms that make sense for clang-tidy.
This check should probably go in a wxWidgets module.