]> granicus.if.org Git - clang/commitdiff
[analyzer] Include comment mistakenly left out of r261243. NFC.
authorDevin Coughlin <dcoughlin@apple.com>
Thu, 18 Feb 2016 19:37:39 +0000 (19:37 +0000)
committerDevin Coughlin <dcoughlin@apple.com>
Thu, 18 Feb 2016 19:37:39 +0000 (19:37 +0000)
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

lib/Analysis/BodyFarm.cpp

index 2118301362e184375a5831d397b0865386cc679a..d8b652f68e8f9cc04b990df4c22f7644a405cb88 100644 (file)
@@ -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;