[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 06:43:15 PDT 2019


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/google/AvoidNSObjectNewCheck.cpp:73
+  // of -init.
+  const StringRef Receiver =
+      getReceiverString(Expr->getReceiverRange(), SM, LangOpts);
----------------
We don't typically make local value types `const` (only pointers or references); here and elsewhere in the patch.


================
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);
----------------
Should this be configurable, or will users not need to control the behavior here?


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

https://reviews.llvm.org/D61350





More information about the cfe-commits mailing list