[PATCH] D55482: [clang-tidy] Improve google-objc-function-naming diagnostics 📙
Stephane Moore via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 10 15:49:56 PST 2018
stephanemoore added inline comments.
================
Comment at: clang-tidy/google/FunctionNamingCheck.cpp:114-125
+ if (MatchedDecl->getStorageClass() == SC_Static) {
+ diag(MatchedDecl->getLocation(),
+ "static function name %0 must be in Pascal case as required by "
+ "Google Objective-C style guide")
+ << MatchedDecl << generateFixItHint(MatchedDecl);
+ return;
+ }
----------------
aaron.ballman wrote:
> I'd rather see these diagnostics combined: `%select{static|global}1 function name %0 must %select{be in |have an appropriate prefixed followed by "}1 Pascal case as required by the Google Objective-C style guide` to simplify the logic (since `generateFixItHint()` already does the right thing).
I had no idea about the select modifier! Good idea!
================
Comment at: test/clang-tidy/google-objc-function-naming.m:8
+// must be in Pascal case as required by Google Objective-C style guide
// CHECK-FIXES: static bool Ispositive(int a) { return a > 0; }
----------------
MyDeveloperDay wrote:
> I realize there are words that begin with 'is...' but you could detect if the function returned a boolean and started with "is,has,does" and could this extrapolate to IsPositive() HasSomething(), DoesHaveSomething(), this might generate a better fixit candidate? (just a suggestion feel free to ignore)
Sounds like something worth investigating.
Filed https://bugs.llvm.org/show_bug.cgi?id=39941
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55482/new/
https://reviews.llvm.org/D55482
More information about the cfe-commits
mailing list