[PATCH] D126097: [clang-tidy] Adds the NSDateFormatter checker to clang-tidy

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 1 12:20:49 PDT 2022

NoQ added a comment.

Uh-oh sorry! I have a couple more questions and then we can probably land.

Comment at: clang-tools-extra/clang-tidy/objc/NSDateFormatterCheck.cpp:24
+  Finder->addMatcher(
+      objcMessageExpr(hasSelector("setDateFormat:"),
+                      hasArgument(0, ignoringImpCasts(
Can or should we check the class name as well? It's probably going to be pretty rare that people have a method with the same name, that also accepts the first argument as a string literal, but that literal means something else entirely. However there's little reason not to be more cautious about that.

Comment at: clang-tools-extra/clang-tidy/objc/NSDateFormatterCheck.cpp:67-68
+    diag(StrExpr->getExprLoc(),
+         "use of calendar year(y) with week of the year(w); "
+         "did you mean to use week-year(Y) instead?");
+  }
I think we want spaces in such cases. I'm not sure, discussion welcome.



More information about the cfe-commits mailing list