r261248 - [analyzer] Include comment mistakenly left out of r261243. NFC.
Devin Coughlin via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 18 11:37:40 PST 2016
Author: dcoughlin
Date: Thu Feb 18 13:37:39 2016
New Revision: 261248
URL: http://llvm.org/viewvc/llvm-project?rev=261248&view=rev
Log:
[analyzer] Include comment mistakenly left out of r261243. NFC.
It explains why we can't just synthesize bodies of setters in BodyFarm.
Modified:
cfe/trunk/lib/Analysis/BodyFarm.cpp
Modified: cfe/trunk/lib/Analysis/BodyFarm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BodyFarm.cpp?rev=261248&r1=261247&r2=261248&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/BodyFarm.cpp (original)
+++ cfe/trunk/lib/Analysis/BodyFarm.cpp Thu Feb 18 13:37:39 2016
@@ -498,6 +498,14 @@ Stmt *BodyFarm::getBody(const ObjCMethod
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;
More information about the cfe-commits
mailing list