-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacheck-requestRequest for a new check in clang-tidyRequest for a new check in clang-tidyclang-tidyconfirmedVerified by a second partyVerified by a second party
Description
Bugzilla Link | 28022 |
Version | unspecified |
OS | All |
CC | @madsravn |
Extended Description
wxWidgets' string class wxString provides operator== for both wxString and wxChar * arguments allowing you to write:
wxString foo;
// ...
if (foo == wxT("foo")) // ...
and
wxString bar;
// ...
if (foo == bar) // ...
It also provides wxString::Cmp
which is intended for sorting functions and returns -1, 0, or 1 depending on the lexicographic relationship of the two strings.
Create a clang-tidy check that replaces:
if (!foo.Cmp(wxT("foo"))) // ...
and
if (foo.Cmp(wxT("foo")) == 0)
with
if (foo == wxT("foo")) // ...
Similarly, replace
if (foo.Cmp(wxT("foo"))) // ...
and
if (foo.Cmp(wxT("foo")) != 0) // ...
with
if (foo != wxT("foo"))
This relates to another wxWidgets specific check
https://llvm.org/bugs/show_bug.cgi?id=27300
and both could go in a wxWidgets module
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacheck-requestRequest for a new check in clang-tidyRequest for a new check in clang-tidyclang-tidyconfirmedVerified by a second partyVerified by a second party