[PATCH] D61350: [clang-tidy] New check calling out uses of +new in Objective-C code

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 11:29:45 PDT 2019


aaron.ballman accepted this revision.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.

LGTM modulo the comments from @gribozavr.



================
Comment at: clang-tools-extra/clang-tidy/google/AvoidNSObjectNewCheck.cpp:76-77
+  // Some classes should use standard factory methods instead of alloc/init.
+  const std::map<StringRef, StringRef> ClassToFactoryMethodMap = {
+      {"NSDate", "date"}, {"NSNull", "null"}};
+  const auto FoundClassFactory = ClassToFactoryMethodMap.find(Receiver);
----------------
mwyman wrote:
> aaron.ballman wrote:
> > Should this be configurable, or will users not need to control the behavior here?
> For now I think there is only this handful of Foundation types commonly created only with the factory methods; I'm not sure it makes a huge amount of sense to open it for configuration at this time.
That seems reasonable to me -- we can add an option later if we find we need one.


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

https://reviews.llvm.org/D61350





More information about the cfe-commits mailing list