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

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 12:41:16 PDT 2019


stephanemoore accepted this revision.
stephanemoore added a comment.

Looks good to me once the comments from other reviewers have been addressed. I added a couple suggestions as well.



================
Comment at: clang-tools-extra/clang-tidy/google/AvoidNSObjectNewCheck.cpp:112
+          Result.Nodes.getNodeAs<ObjCMessageExpr>("new_call")) {
+    // Don't warn if the call expression originates from a macro expansion.
+    if (isMessageExpressionInsideMacro(CallExpr))
----------------
If the message expression is within a macro expansion, maybe we should emit the diagnostic without the fixit?


================
Comment at: clang-tools-extra/test/clang-tidy/google-objc-avoid-nsobject-new.m:1
+// RUN: %check_clang_tidy %s google-objc-avoid-nsobject-new %t
+
----------------
Suggestion:
It might be good to add a test case for another root class that doesn't have `-init`, e.g., `NSProxy`.


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

https://reviews.llvm.org/D61350





More information about the cfe-commits mailing list