[analyzer] Fix a false positive of the 'self' initialization checker.
commit0ca1040a964e6375561cc8e90d9b20ebcd6bffa8
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 5 Feb 2011 05:54:53 +0000 (5 05:54 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 5 Feb 2011 05:54:53 +0000 (5 05:54 +0000)
treee11ee376aeb86564fb8ee811e898ee0105b12899
parent1de34dd8a6932fbb316e35304bf468ddb4a0841b
[analyzer] Fix a false positive of the 'self' initialization checker.

A common pattern in classes with multiple initializers is to put the
subclass's common initialization bits into a static function that receives
the value of 'self', e.g:

   if (!(self = [super init]))
     return nil;
   if (!(self = _commonInit(self)))
     return nil;

It was reported that 'self' was not set to the result of [super init].
Until we can use inter-procedural analysis, in such a call, transfer the
ObjCSelfInitChecker flags associated with 'self' to the result of the call.

Fixes rdar://8937441 & http://llvm.org/PR9094

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124940 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
test/Analysis/self-init.m