================
@@ -355,14 +355,30 @@ class RetainPtrCtorAdoptChecker
void visitBinaryOperator(const BinaryOperator *BO) const {
if (!BO->isAssignmentOp())
return;
- if (!isa<ObjCIvarRefExpr>(BO->getLHS()))
- return;
+ auto *LHS = BO->getLHS();
auto *RHS = BO->getRHS()->IgnoreParenCasts();
- const Expr *Inner = nullptr;
- if (isAllocInit(RHS, &Inner)) {
- CreateOrCopyFnCall.insert(RHS);
- if (Inner)
- CreateOrCopyFnCall.insert(Inner);
+ if (isa<ObjCIvarRefExpr>(LHS)) {
+ const Expr *Inner = nullptr;
+ if (isAllocInit(RHS, &Inner)) {
+ CreateOrCopyFnCall.insert(RHS);
+ if (Inner)
+ CreateOrCopyFnCall.insert(Inner);
+ }
+ return;
+ } else if (auto *UO = dyn_cast<UnaryOperator>(LHS)) {
----------------
steakhal wrote:
In LLVM I think we try to obey the rule of no
[else-after-return](https://clang.llvm.org/extra/clang-tidy/checks/readability/else-after-return.html)
rule.
Honouring the rule usually means that we can reduce indentation of the guarded
block by one level.
https://github.com/llvm/llvm-project/pull/161633
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits