[PATCH] D77571: [clang-tidy] Add check to find calls to NSInvocation methods under ARC that don't have proper object argument lifetimes.
Michael Wyman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 9 01:36:11 PDT 2020
mwyman updated this revision to Diff 256209.
mwyman marked an inline comment as done.
mwyman added a comment.
Updating per Stephane's comments. To deal with struct fields needed to match MemberRefExprs.
However, in doing so I discovered that the match conditions I thought were catching ObjcIvarRefExpr or MemberRefExpr were sometimes incorrectly matching on the self reference, which is itself a DeclRefExpr to an object with strong lifetime semantics. This meant correct usages would sometimes be caught, because the ObjcIvarRefExpr wouldn't match but the DeclRefExpr (to self) did.
That self (or other object) that is dereferenced (implicity or explicitly) has a parent ImplicitCastExpr in the AST, so I've dealt with this situation by excluding that case from matching the declRefExpr.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77571/new/
https://reviews.llvm.org/D77571
Files:
clang-tools-extra/clang-tidy/objc/CMakeLists.txt
clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp
clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.h
clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/docs/clang-tidy/checks/objc-nsinvocation-argument-lifetime.rst
clang-tools-extra/test/clang-tidy/checkers/objc-nsinvocation-argument-lifetime.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77571.256209.patch
Type: text/x-patch
Size: 16757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200409/a9531fee/attachment-0001.bin>
More information about the cfe-commits
mailing list