From: Devin Coughlin Date: Thu, 18 Feb 2016 19:37:39 +0000 (+0000) Subject: [analyzer] Include comment mistakenly left out of r261243. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee128546797a12899c7eae86c27dfdbd061daaa6;p=clang [analyzer] Include comment mistakenly left out of r261243. NFC. It explains why we can't just synthesize bodies of setters in BodyFarm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261248 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/BodyFarm.cpp b/lib/Analysis/BodyFarm.cpp index 2118301362..d8b652f68e 100644 --- a/lib/Analysis/BodyFarm.cpp +++ b/lib/Analysis/BodyFarm.cpp @@ -498,6 +498,14 @@ Stmt *BodyFarm::getBody(const ObjCMethodDecl *D) { return nullptr; // For now, we only synthesize getters. + // Synthesizing setters would cause false negatives in the + // RetainCountChecker because the method body would bind the parameter + // to an instance variable, causing it to escape. This would prevent + // warning in the following common scenario: + // + // id foo = [[NSObject alloc] init]; + // self.foo = foo; // We should warn that foo leaks here. + // if (D->param_size() != 0) return nullptr;