[PATCH] D55101: [clang-tidy] Ignore namespaced and C++ member functions in google-objc-function-naming check 🙈

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 30 15:54:54 PST 2018


stephanemoore added a comment.

In D55101#1315294 <https://reviews.llvm.org/D55101#1315294>, @benhamilton wrote:

> > Would you be okay with landing this fix and if we get any further reports for Objective-C++ sources then we can suppress it in all C++/Objective-C++ sources? I think there is enough value to enforcing the naming conventions on non-namespaced C functions in Objective-C++ to justify a simple followup fix. If other issues are reported after this then I also agree that enforcement in Objective-C++ sources may incur more overhead than it's worth.
>
> I'm not against it, but we've already disabled the majority of Objective-C checks for Objective-C++ code, so I don't think this one should apply either.


Within the module named "google-module", I only see that AvoidCStyleCastsCheck is disabled for Objective-C++. That check is probably disabled because C-style casts on Objective-C types in Objective-C++ code are not seen as a major issue and the cost of refactoring code to use or not use C-style casts as code is refactored between Objective-C and Objective-C++ sources might be considered high.
Within the module named "objc-module", it appears that all checks are currently enabled for Objective-C++ code.
Looking across all the clang-tidy modules, AvoidCStyleCastsCheck might actually be the only check that is specifically disabled for Objective-C++ (although the `grep` I used to posit this assumes that any check that is suppressed in Objective-C++ must contain the string `getLangOpts().ObjC`: `grep -r "getLangOpts().ObjC" clang-tidy/`).

There are certainly cases where the heterogeneity of Objective-C++ encourages disabling a check due to inability to distinguish between whether C++ or Objective-C practices should be contextually dominant. I think that google-objc-function-naming should be able to cleanly separate declarations that should follow C++ or Objective-C patterns. If further bugs are reported after this is submitted then I am more willing to concede that I was overly optimistic. If it's alright with you, I would prefer to land this fix to give google-objc-function-naming another attempt at proper enforcement in Objective-C++ and consider disabling it in all C++ variants as a followup to further bug reports in Objective-C++.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D55101





More information about the cfe-commits mailing list