[PATCH] D73098: [clang-tidy] readability-identifier-naming disregards parameters restrictions on main like functions

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 14:41:51 PST 2020


njames93 marked an inline comment as done.
njames93 added a comment.

In D73098#1832131 <https://reviews.llvm.org/D73098#1832131>, @Mordante wrote:

> Would it make sense to also allow wmain with wchar_t? https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=vs-2019


Does wmain get used in a lot of projects. If it's very niche then I don't feel it warrants a place in here. If it does I'll add it in.



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:474
   if (const auto *Decl = dyn_cast<ParmVarDecl>(D)) {
+    if (isParamInMainLikeFunction(*Decl))
+      return SK_Invalid;
----------------
aaron.ballman wrote:
> I think a better approach may be to look at the `DeclContext` for the `ParmVarDecl` object to see if it is a `FunctionDecl`, and if it is, call `FunctionDecl::isMain()` to check.
I specifically didn't want to do that as is I want to get functions that act like main, usually the case when main itself dispatches to other functions with the same signature. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73098/new/

https://reviews.llvm.org/D73098





More information about the cfe-commits mailing list