[biabd] do not try to bypass `Ondemand` to get proc desc of models

Summary:
After some testing, it looks like getting the pdesc via
`Ondemand.get_proc_desc` will also load models' proc descs from their
summaries, so this code should not be needed.

Reviewed By: jeremydubreil, mbouaziz, martintrojer

Differential Revision: D9197176

fbshipit-source-id: 1b8603bfa
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 55c2188615
commit d9e12850b9

@ -719,28 +719,16 @@ let resolve_and_analyze tenv ~caller_pdesc ?(has_clang_model= false) prop args c
let analyze specialized_pdesc = Ondemand.analyze_proc_desc ~caller_pdesc specialized_pdesc in
let resolved_proc_desc_option =
match Ondemand.get_proc_desc resolved_pname with
| Some resolved_proc_desc ->
Some resolved_proc_desc
| Some _ as resolved_proc_desc ->
resolved_proc_desc
| None ->
let procdesc_opt =
(* If it is a model, we aim to get the procdesc stored in a summary rather than the
(empty) procdesc stored in the caller's cfg. *)
if has_clang_model then
match Summary.get callee_proc_name with
| Some summary ->
Some (Summary.get_proc_desc summary)
| None ->
Ondemand.get_proc_desc callee_proc_name
else Ondemand.get_proc_desc callee_proc_name
in
Option.map
~f:(fun callee_proc_desc ->
(* It is possible that the types of the arguments are not as precise as the type of the objects
in the heap, so we should update them to get the best results. *)
let procdesc_opt = Ondemand.get_proc_desc callee_proc_name in
Option.map procdesc_opt ~f:(fun callee_proc_desc ->
(* It is possible that the types of the arguments are not as precise as the type of
the objects in the heap, so we should update them to get the best results. *)
let resolved_args = resolve_args prop args in
Procdesc.specialize_types ~has_clang_model callee_proc_desc resolved_pname
resolved_args )
procdesc_opt
in
(resolved_proc_desc_option, Option.bind resolved_proc_desc_option ~f:analyze)
in
@ -1145,8 +1133,8 @@ let resolve_and_analyze_clang current_pdesc tenv prop_r n_actual_params callee_p
n_actual_params callee_pname call_flags
in
(* It could be useful to specialize a model, but also it could cause a failure,
because we don't have the correct fields in the tenv.
In that case, default to the non-specialized spec for the model. *)
because we don't have the correct fields in the tenv.
In that case, default to the non-specialized spec for the model. *)
let clang_model_specialized_failure =
match resolve_and_analyze_result.resolved_summary_opt with
| Some summary when has_clang_model ->

@ -23,24 +23,24 @@ SOURCES_DEFAULT = \
field_superclass/B.m \
memory_leaks_benchmark/MemoryLeakRaii.m \
memory_leaks_benchmark/NSString_models_tests.m \
memory_leaks_benchmark/NSData_models_tests.m \
memory_leaks_benchmark/NSData_models_tests.m \
memory_leaks_benchmark/RetainReleaseExampleBucketing.m \
memory_leaks_benchmark/CoreVideoExample.m \
memory_leaks_benchmark/RetainCycleLength3.m \
memory_leaks_benchmark/ReleasedInBlock.m \
memory_leaks_benchmark/CoreVideoExample.m \
memory_leaks_benchmark/RetainCycleLength3.m \
memory_leaks_benchmark/ReleasedInBlock.m \
npe/dynamic_dispatch.m \
npe/Fraction.m \
npe/NPD_core_foundation.m \
npe/Npe_with_equal_names.m \
npe/block.m \
npe/ivar_blocks.m \
npe/ivar_blocks.m \
npe/skip_method_with_nil_object.m \
npe/Nsstring_length_no_npe.m \
npe/No_null_from_array.m \
npe/Nsstring_length_no_npe.m \
npe/No_null_from_array.m \
procdescs/MethodCall.m \
property/main.c \
resource_leaks/ResourceLeakExample.m \
resource_leaks/Dispatch_sources.m \
resource_leaks/Dispatch_sources.m \
shared/block/block-it.m \
shared/block/dispatch.m \
shared/category_procdesc/EOCPerson.m \
@ -49,15 +49,15 @@ SOURCES_DEFAULT = \
shared/memory_leaks_benchmark/MemoryLeakExample.m \
shared/memory_leaks_benchmark/RetainReleaseExample.m \
shared/memory_leaks_benchmark/arc_methods.m \
shared/npe/Available_expr.m \
shared/npe/Available_expr.m \
shared/npe/Nonnull_attribute_example.m \
shared/property/GetterExample.m \
shared/property/PropertyAttributes.m \
shared/protocol_procdesc/Bicycle.m \
shared/protocol_procdesc/main.c \
shared/annotations/nullable_annotations.m \
shared/annotations/nullable_annotations_fields.m \
shared/annotations/nonnull_annotations.m \
shared/annotations/nullable_annotations.m \
shared/annotations/nullable_annotations_fields.m \
shared/annotations/nonnull_annotations.m \
taint/sources.m \
taint/viewController.m \
@ -79,7 +79,7 @@ SOURCES_BUCKET_ALL = \
shared/block/block_no_args.m \
shared/block/block_release.m \
shared/block/dispatch_in_macro.m \
shared/block/Blocks_as_parameters.m \
shared/block/Blocks_as_parameters.m \
shared/category_procdesc/main.c \
shared/field_superclass/SuperExample.m \
shared/npe/npe_malloc.m \
@ -87,18 +87,18 @@ SOURCES_BUCKET_ALL = \
SOURCES_ARC = \
field_superclass/SubtypingExample.m \
blocks_in_heap/BlockInHeap.m \
blocks_in_heap/BlockInHeap.m \
initialization/struct_initlistexpr.c \
memory_leaks_benchmark/CADisplayLinkRetainCycle.m \
memory_leaks_benchmark/RetainCycleExampleWeak.m \
memory_leaks_benchmark/CADisplayLinkRetainCycle.m \
memory_leaks_benchmark/RetainCycleExampleWeak.m \
memory_leaks_benchmark/RetainReleaseExampleBucketingArc.m \
memory_leaks_benchmark/retain_cycle.m \
memory_leaks_benchmark/retain_cycle2.m \
memory_leaks_benchmark/RetainCycleBlocks.m \
memory_leaks_benchmark/RetainCyclePropertyInProtocol.m \
memory_leaks_benchmark/RetainCycleBlockAsParameter.m \
memory_leaks_benchmark/RetainCycleBlockCapturedVar.m \
memory_leaks_benchmark/RetainCycleDeduplication.m \
memory_leaks_benchmark/RetainCycleBlocks.m \
memory_leaks_benchmark/RetainCyclePropertyInProtocol.m \
memory_leaks_benchmark/RetainCycleBlockAsParameter.m \
memory_leaks_benchmark/RetainCycleBlockCapturedVar.m \
memory_leaks_benchmark/RetainCycleDeduplication.m \
npe/BoxedNumberExample.m \
npe/ObjCMethodCallInCondition.m \
npe/UpdateDict.m \
@ -107,7 +107,7 @@ SOURCES_ARC = \
npe/nil_in_dictionary_literal.m \
npe/npe_conditional.m \
npe/npe_self.m \
npe/Npe_self_annotation.m \
npe/Npe_self_annotation.m \
npe/nullable.m \
property/ExplicitIvarName.m \
shared/block/dispatch_examples.m \

@ -72,7 +72,6 @@ codetoanalyze/objc/errors/subtyping/KindOfClassExample.m, shouldThrowDivideByZer
codetoanalyze/objc/errors/subtyping/KindOfClassExample.m, shouldThrowDivideByZero2, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure shouldThrowDivideByZero2(),start of procedure init,return from a call to Base_init,start of procedure returnsZero2(),Taking false branch,return from a call to returnsZero2]
codetoanalyze/objc/errors/subtyping/KindOfClassExample.m, shouldThrowDivideByZero3, 3, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure shouldThrowDivideByZero3(),start of procedure init,return from a call to Derived_init,Taking true branch]
codetoanalyze/objc/errors/variadic_methods/premature_nil_termination.m, PrematureNilTermA_nilInArrayWithObjects, 5, PREMATURE_NIL_TERMINATION_ARGUMENT, B1, ERROR, [start of procedure nilInArrayWithObjects]
objc/src/CADisplayLink.m, CADisplayLink_displayLinkWithTarget:selector:, 3, Missing_fld, no_bucket, ERROR, [start of procedure displayLinkWithTarget:selector:]
codetoanalyze/objc/errors/memory_leaks_benchmark/CoreVideoExample.m, CoreVideoExample_cvpixelbuffer_not_released_leak, 1, MEMORY_LEAK, no_bucket, ERROR, [start of procedure cvpixelbuffer_not_released_leak]
codetoanalyze/objc/errors/memory_leaks_benchmark/NSData_models_tests.m, NSData_models_tests_macForIV:, 2, MEMORY_LEAK, no_bucket, ERROR, [start of procedure macForIV:]
codetoanalyze/objc/errors/memory_leaks_benchmark/NSString_models_tests.m, StringInitA_hexStringValue, 11, MEMORY_LEAK, no_bucket, ERROR, [start of procedure hexStringValue,Skipping CFStringCreateWithBytesNoCopy(): method has no implementation,Taking false branch]

Loading…
Cancel
Save