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

Michael Wyman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 10:05:01 PDT 2019


mwyman marked 3 inline comments as done.
mwyman added inline comments.


================
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);
----------------
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.


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

https://reviews.llvm.org/D61350





More information about the cfe-commits mailing list