From 29c42e5fe88d1fee5fff62570d06bb1578705773 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Fri, 16 Dec 2016 09:06:36 -0800 Subject: [PATCH] [reporting] Skip traces for functions outside of project root Summary: Most of the time code outside of project root is not interesting to the user - it's either system library or infer C++ model. Skip all of them. Previous logic was doing something similar, but in more selective way. I also need this change for D4313428 Reviewed By: jvillard Differential Revision: D4339298 fbshipit-source-id: c7b5544 --- infer/src/IR/AttributesTable.re | 6 +++--- infer/src/IR/AttributesTable.rei | 4 ++-- infer/src/backend/tabulation.ml | 4 +--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/infer/src/IR/AttributesTable.re b/infer/src/IR/AttributesTable.re index 2186acaff..76f336dcc 100644 --- a/infer/src/IR/AttributesTable.re +++ b/infer/src/IR/AttributesTable.re @@ -136,10 +136,10 @@ let get_correct_type_from_objc_class_name type_name => Some (Typ.Tstruct type_name); -/** Returns true if the method is defined as a C++ model */ -let pname_is_cpp_model callee_pname => +/** Returns true if the method is defined under project root */ +let pname_is_under_project_root callee_pname => switch (load_attributes callee_pname) { - | Some attrs => SourceFile.is_cpp_model attrs.ProcAttributes.loc.Location.file + | Some attrs => SourceFile.is_under_project_root attrs.ProcAttributes.loc.Location.file | None => false }; diff --git a/infer/src/IR/AttributesTable.rei b/infer/src/IR/AttributesTable.rei index 38d6cff0f..b6c7a588a 100644 --- a/infer/src/IR/AttributesTable.rei +++ b/infer/src/IR/AttributesTable.rei @@ -29,8 +29,8 @@ let load_defined_attributes: cache_none::bool => Procname.t => option ProcAttrib let get_correct_type_from_objc_class_name: Typename.t => option Typ.t; -/** Returns true if the method is defined as a C++ model */ -let pname_is_cpp_model: Procname.t => bool; +/** Returns true if the method is defined under project root */ +let pname_is_under_project_root: Procname.t => bool; /* Find the file where the procedure was captured, if a cfg for that file exists. Return also a boolean indicating whether the procedure is defined in an diff --git a/infer/src/backend/tabulation.ml b/infer/src/backend/tabulation.ml index 5c98d7d72..80c40f467 100644 --- a/infer/src/backend/tabulation.ml +++ b/infer/src/backend/tabulation.ml @@ -664,9 +664,7 @@ let prop_set_exn tenv pname prop se_exn = (** Include a subtrace for a procedure call if the callee is not a model. *) let include_subtrace callee_pname = - not (Specs.is_model callee_pname) && - not (AttributesTable.pname_is_cpp_model callee_pname) && - not (AttributesTable.is_whitelisted_cpp_method (Procname.to_string callee_pname)) + not (Specs.is_model callee_pname) && (AttributesTable.pname_is_under_project_root callee_pname) (** combine the spec's post with a splitting and actual precondition *) let combine tenv