[infer][objc] example of HIL translation using Objective C closure

Summary: The case of closures was not considered for the convertion of SIL instructions into HIL instructions

Reviewed By: sblackshear

Differential Revision: D5929675

fbshipit-source-id: bb6920a
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 14d0e2a786
commit 37bdf46967

@ -94,7 +94,7 @@ let of_sil ~include_array_indexes ~f_resolve_id (instr: Sil.instr) =
-> let hil_ret = Option.map ~f:(fun (ret_id, ret_typ) -> (Var.of_id ret_id, ret_typ)) ret_opt in
let hil_call =
match exp_of_sil call_exp (Typ.mk Tvoid) with
| Constant Cfun procname
| Constant Cfun procname | Closure (procname, _)
-> Direct procname
| AccessPath access_path
-> Indirect access_path

@ -40,6 +40,18 @@
}
}
- (int)testUnnanotatedFieldInClosureBad {
int (^testField)(int defaultValue);
testField = ^(int defaultValue) {
if (unnanotatedField != nil) {
return *unnanotatedField;
} else {
return defaultValue;
}
};
return testField(42);
}
- (void)testNonnullFieldForNullBad {
if (nonnullField == nil) {
}

@ -7,3 +7,4 @@ codetoanalyze/objc/checkers/Nullable.m, T_dereferenceUnnanotatedFieldAfterTestFo
codetoanalyze/objc/checkers/Nullable.m, T_dereferenceUnnanotatedFieldAfterTestForNullBad, 2, NULL_DEREFERENCE, [start of procedure dereferenceUnnanotatedFieldAfterTestForNullBad,Condition is true]
codetoanalyze/objc/checkers/Nullable.m, T_testNonnullFieldForNullBad, 1, FIELD_SHOULD_BE_NULLABLE, [Field nonnullField is compared to null here]
codetoanalyze/objc/checkers/Nullable.m, T_testUnnanotatedFieldForNullBad, 1, FIELD_SHOULD_BE_NULLABLE, [Field unnanotatedField is compared to null here]
codetoanalyze/objc/checkers/Nullable.m, __objc_anonymous_block_T_testUnnanotatedFieldInClosureBad______1, 1, FIELD_SHOULD_BE_NULLABLE, [Field unnanotatedField is compared to null here]

Loading…
Cancel
Save