diff --git a/infer/src/IR/Sil.ml b/infer/src/IR/Sil.ml index 7ea560956..490829987 100644 --- a/infer/src/IR/Sil.ml +++ b/infer/src/IR/Sil.ml @@ -126,8 +126,9 @@ let exps_of_instr = function [e1; e2] | Prune (cond, _, _, _) -> [cond] - | Call ((id, _), e, _, _, _) -> - [e; Exp.Var id] + | Call ((id, _), e, exps, _, _) -> + let exps = List.map ~f:fst exps in + e :: Exp.Var id :: exps | Metadata metadata -> exps_of_instr_metadata metadata diff --git a/infer/tests/codetoanalyze/objc/self-in-block/NoescapeBlock.m b/infer/tests/codetoanalyze/objc/self-in-block/NoescapeBlock.m index 2d1fe153f..4e5662cd9 100644 --- a/infer/tests/codetoanalyze/objc/self-in-block/NoescapeBlock.m +++ b/infer/tests/codetoanalyze/objc/self-in-block/NoescapeBlock.m @@ -21,7 +21,9 @@ - (B*)process:(B*)obj; @end -@implementation A +@implementation A { + int x; +} - (B*)process:(B*)obj { return obj; @@ -62,4 +64,23 @@ return resultsList; } +- (NSMutableArray*)weak_in_block_inside_noescape_block_good: + (NSArray*)allResults { + NSMutableArray* resultsList = [[NSMutableArray alloc] init]; + __weak __typeof(self) weakSelf = self; + [allResults enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL* stop) { + B* result = [self process:obj]; + if (result != nil) { + [resultsList addObject:result]; + } + [ArrayUtils enumerate:^(id obj, NSUInteger idx, BOOL* stop) { + __strong __typeof(weakSelf) strongSelf = weakSelf; // no bug here + if (strongSelf) { + int x = strongSelf->x; + } + }]; + }]; + return resultsList; +} + @end