From 96e5a976c4953cf8c46b114dd89f41db523be1fa Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Fri, 4 May 2018 07:06:18 -0700 Subject: [PATCH] [clang] Make the frontend with compilation database fail with compilation errors Reviewed By: jvillard Differential Revision: D7860012 fbshipit-source-id: acc9abc --- infer/src/IR/Typ.ml | 6 ++++++ infer/src/IR/Typ.mli | 4 ++++ infer/src/biabduction/SymExec.ml | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/infer/src/IR/Typ.ml b/infer/src/IR/Typ.ml index 06ef5904a..ddb02df87 100644 --- a/infer/src/IR/Typ.ml +++ b/infer/src/IR/Typ.ml @@ -359,6 +359,8 @@ module Name = struct let is_class = function CppClass _ | JavaClass _ | ObjcClass _ -> true | _ -> false + let is_objc_protocol name = match name with ObjcProtocol _ -> true | _ -> false + let is_same_type t1 t2 = match (t1, t2) with | CStruct _, CStruct _ @@ -878,6 +880,10 @@ module Procname = struct t + let rec is_method_in_objc_protocol t = + match t with ObjC_Cpp osig -> Name.is_objc_protocol osig.class_name | _ -> false + + let rec objc_cpp_replace_method_name t (new_method_name: string) = match t with | ObjC_Cpp osig -> diff --git a/infer/src/IR/Typ.mli b/infer/src/IR/Typ.mli index 943e9aa1e..8c905e498 100644 --- a/infer/src/IR/Typ.mli +++ b/infer/src/IR/Typ.mli @@ -133,6 +133,8 @@ module Name : sig val is_class : t -> bool (** [is_class name] holds if [name] names CPP/Objc/Java class *) + val is_objc_protocol : t -> bool + val is_same_type : t -> t -> bool (** [is_class name1 name2] holds if [name1] and [name2] name same kind of type *) @@ -508,6 +510,8 @@ module Procname : sig (** Replace the class name component of a procedure name. In case of Java, replace package and class name. *) + val is_method_in_objc_protocol : t -> bool + val to_string : t -> string (** Convert a proc name to a string for the user to see. *) diff --git a/infer/src/biabduction/SymExec.ml b/infer/src/biabduction/SymExec.ml index f98da7ed0..38d039dbf 100644 --- a/infer/src/biabduction/SymExec.ml +++ b/infer/src/biabduction/SymExec.ml @@ -1249,6 +1249,13 @@ let rec sym_exec exe_env tenv current_pdesc instr_ (prop_: Prop.normal Prop.t) p else [(prop_r, path)] in let do_call (prop, path) = + ( match resolved_summary_opt with + | Some resolved_summary -> + Logging.progress "%a is defined %b@." Typ.Procname.pp resolved_pname + (Specs.get_attributes resolved_summary).ProcAttributes.is_defined + | None -> + Logging.progress "%a is objc protocol %b@." Typ.Procname.pp resolved_pname + (Typ.Procname.is_method_in_objc_protocol resolved_pname) ) ; let reason_to_skip_opt = Option.value_map ~f:reason_to_skip ~default:(Some "function or method not found") resolved_summary_opt