aaron.ballman added inline comments.
================
Comment at:
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:383
+ } else {
+ static llvm::Regex Matcher("(^((W[Mm])|(wm))ain([_A-Z]|$))|([a-z0-9_]W[Mm]"
+ "ain([_A-Z]|$))|(_wmain(_|$))",
----------------
njames93 wrote:
> Any thoughts on whether I should detect WMain or just Wmain. WMain looks more
> pleasing but using CamelCase rules it should likely be Wmain
I think this needs to be controlled by an option if we want to keep it, because
you can still have names like `terminateMain(int exitCode, char *msgs[]);` At
the end of the day, no matter what regex we come up with, we can probably pick
an identifier that subverts the check. Also, the name `main` might have
different meanings if the function is a member function or a member of a
namespace (or, alternatively, it may actually relate to the main entrypoint).
Ultimately, this seems too much like guessing at user intent, which is why I
think it should be an option (and probably off by default).
That said, if we're searching for main-like names, I think we need to find
names like wmain, Wmain, wMain, WMain optionally with a prefix or suffix
(perhaps with underscores). I am less certain how to treat member functions,
but suspect the reasonable thing to do is treat them as being potentially
main-like regardless of whether they're static or not, but the function still
needs to be publicly available rather than private or protected (those can't be
main-like, unless someone friends main... which is another twist).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73098/new/
https://reviews.llvm.org/D73098
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits