diff --git a/infer/src/IR/ProcAttributes.ml b/infer/src/IR/ProcAttributes.ml index 1349264a8..a62e05b84 100644 --- a/infer/src/IR/ProcAttributes.ml +++ b/infer/src/IR/ProcAttributes.ml @@ -35,6 +35,21 @@ type clang_method_kind = let clang_method_kind_equal = [%compare.equal : clang_method_kind] +let string_of_clang_method_kind = function + | CPP_INSTANCE -> + "CPP_INSTANCE" + | OBJC_INSTANCE -> + "OBJC_INSTANCE" + | CPP_CLASS -> + "CPP_CLASS" + | OBJC_CLASS -> + "OBJC_CLASS" + | BLOCK -> + "BLOCK" + | C_FUNCTION -> + "C_FUNCTION" + + (** Type for ObjC accessors *) type objc_accessor_type = | Objc_getter of Typ.Struct.field diff --git a/infer/src/IR/ProcAttributes.mli b/infer/src/IR/ProcAttributes.mli index 4a8b8748d..6c79e4f84 100644 --- a/infer/src/IR/ProcAttributes.mli +++ b/infer/src/IR/ProcAttributes.mli @@ -25,6 +25,8 @@ type clang_method_kind = val clang_method_kind_equal : clang_method_kind -> clang_method_kind -> bool +val string_of_clang_method_kind : clang_method_kind -> string + type objc_accessor_type = | Objc_getter of Typ.Struct.field | Objc_setter of Typ.Struct.field diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index a9351a049..0b2bf5200 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -552,6 +552,10 @@ module Stats = struct ; analysis_total_nodes= Specs.get_proc_desc summary |> Procdesc.get_nodes_num ; symops= summary.stats.symops ; method_location= Specs.get_loc summary + ; lang= + Specs.get_proc_name summary |> Typ.Procname.get_language + |> Language.to_explicit_string + ; clang_method_kind= (Specs.get_attributes summary).clang_method_kind ; analysis_status= summary.stats.stats_failure ; method_name= Specs.get_proc_name summary |> Typ.Procname.to_string } :: stats.events_to_log diff --git a/infer/src/base/EventLogger.ml b/infer/src/base/EventLogger.ml index 07fc2c06d..496ceebd8 100644 --- a/infer/src/base/EventLogger.ml +++ b/infer/src/base/EventLogger.ml @@ -130,6 +130,8 @@ type analysis_stats = ; analysis_total_nodes: int ; symops: int ; method_location: Location.t + ; lang: string + ; clang_method_kind: ProcAttributes.clang_method_kind ; analysis_status: SymOp.failure_kind option ; method_name: string } @@ -146,6 +148,9 @@ let create_analysis_stats_row base record = [ string_of_int record.method_location.line ; ":" ; string_of_int record.method_location.col ]) + |> add_string ~key:"lang" ~data:record.lang + |> add_string ~key:"clang_method_kind" + ~data:(ProcAttributes.string_of_clang_method_kind record.clang_method_kind) |> add_string ~key:"analysis_status" ~data: (Option.value_map record.analysis_status ~default:"OK" ~f:(fun stats_failure -> diff --git a/infer/src/base/EventLogger.mli b/infer/src/base/EventLogger.mli index 07a5e5839..52f8d7fc8 100644 --- a/infer/src/base/EventLogger.mli +++ b/infer/src/base/EventLogger.mli @@ -28,6 +28,8 @@ type analysis_stats = ; analysis_total_nodes: int ; symops: int ; method_location: Location.t + ; lang: string + ; clang_method_kind: ProcAttributes.clang_method_kind ; analysis_status: SymOp.failure_kind option ; method_name: string } diff --git a/infer/src/base/Language.ml b/infer/src/base/Language.ml index 1ef73d48d..0728290b8 100644 --- a/infer/src/base/Language.ml +++ b/infer/src/base/Language.ml @@ -16,6 +16,8 @@ let language_to_string = [(Clang, "C/C++/ObjC"); (Java, "Java"); (Python, "pytho let to_string lang = List.Assoc.find_exn language_to_string ~equal lang +let to_explicit_string = function Clang -> "Clang" | Java -> "Java" | Python -> "Python" + let of_string s = List.Assoc.find (List.Assoc.inverse language_to_string) ~equal:String.equal s (** Current language *) diff --git a/infer/src/base/Language.mli b/infer/src/base/Language.mli index 3eb638212..7f15aff96 100644 --- a/infer/src/base/Language.mli +++ b/infer/src/base/Language.mli @@ -15,6 +15,8 @@ val equal : t -> t -> bool val to_string : t -> string +val to_explicit_string : t -> string + val of_string : string -> t option val curr_language : t ref