[PATCH] D77571: Add ClangTidy check to find calls to NSInvocation methods under ARC that don't have proper object argument lifetimes.

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 12:32:06 PDT 2020


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/objc/NsinvocationArgumentLifetimeCheck.cpp:35
+
+constexpr StringRef WeakText = "__weak";
+constexpr StringRef StrongText = "__strong";
----------------
Please use static instead of anonymous namespace for variable.


================
Comment at: clang-tools-extra/clang-tidy/objc/NsinvocationArgumentLifetimeCheck.cpp:50
+
+llvm::Optional<FixItHint> replacementForOwnershipString(StringRef Text,
+                                                        CharSourceRange Range,
----------------
Please use static instead of anonymous namespace for functions.


================
Comment at: clang-tools-extra/clang-tidy/objc/NsinvocationArgumentLifetimeCheck.cpp:83
+  StringRef VarDeclText = Lexer::getSourceText(Range, SM, LangOpts);
+  if (auto Hint = replacementForOwnershipString(VarDeclText, Range, WeakText)) {
+    return Hint;
----------------
Please don't use auto unless type is spelled in same statement or iterator. Please elide braces. Same in other places.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:135
+
+  Finds calls to NSInvocation methods under ARC that don't have proper
+  argument object lifetimes.
----------------
Please enclose NSInvocation in double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/objc-nsinvocation-argument-lifetime.rst:6
+
+Finds calls to NSInvocation methods under ARC that don't have proper
+argument object lifetimes. When passing Objective-C objects as parameters
----------------
Please enclose NSInvocation in double back-ticks. Same below.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77571





More information about the cfe-commits mailing list