diff --git a/infer/src/clang/CMethodProperties.ml b/infer/src/clang/CMethodProperties.ml index 2bc1ef8d0..14f5e528d 100644 --- a/infer/src/clang/CMethodProperties.ml +++ b/infer/src/clang/CMethodProperties.ml @@ -79,19 +79,6 @@ let get_method_body method_decl = raise CFrontend_config.Invalid_declaration -let get_language ~is_cpp method_decl = - let open Clang_ast_t in - match method_decl with - | FunctionDecl _ -> - if is_cpp then CFrontend_config.CPP else CFrontend_config.ObjC - | CXXMethodDecl _ | CXXConstructorDecl _ | CXXConversionDecl _ | CXXDestructorDecl _ -> - CFrontend_config.CPP - | ObjCMethodDecl _ | BlockDecl _ -> - CFrontend_config.ObjC - | _ -> - raise CFrontend_config.Invalid_declaration - - let is_cpp_virtual method_decl = let open Clang_ast_t in match method_decl with diff --git a/infer/src/clang/CMethodProperties.mli b/infer/src/clang/CMethodProperties.mli index 96f08c4d0..b1cacd1dc 100644 --- a/infer/src/clang/CMethodProperties.mli +++ b/infer/src/clang/CMethodProperties.mli @@ -19,8 +19,6 @@ val get_param_decls : Clang_ast_t.decl -> Clang_ast_t.decl list val get_method_body : Clang_ast_t.decl -> Clang_ast_t.stmt option -val get_language : is_cpp:bool -> Clang_ast_t.decl -> CFrontend_config.clang_lang - val is_cpp_virtual : Clang_ast_t.decl -> bool val is_cpp_nothrow : Clang_ast_t.decl -> bool diff --git a/infer/src/clang/CType_decl.ml b/infer/src/clang/CType_decl.ml index a3e2f5182..91880e843 100644 --- a/infer/src/clang/CType_decl.ml +++ b/infer/src/clang/CType_decl.ml @@ -142,7 +142,6 @@ module BuildMethodSignature = struct get_parameters qual_type_to_sil_type ~is_cpp tenv ~block_return_type method_decl in let attributes = decl_info.Clang_ast_t.di_attributes in - let lang = CMethodProperties.get_language ~is_cpp method_decl in let is_cpp_virtual = CMethodProperties.is_cpp_virtual method_decl in let is_cpp_nothrow = CMethodProperties.is_cpp_nothrow method_decl in let access = decl_info.Clang_ast_t.di_access in @@ -157,7 +156,6 @@ module BuildMethodSignature = struct ; method_kind ; is_cpp_virtual ; is_cpp_nothrow - ; lang ; pointer_to_parent ; pointer_to_property_opt ; return_param_typ } diff --git a/infer/src/clang/cFrontend_decl.ml b/infer/src/clang/cFrontend_decl.ml index e3eed3cc1..ea83e9209 100644 --- a/infer/src/clang/cFrontend_decl.ml +++ b/infer/src/clang/cFrontend_decl.ml @@ -417,8 +417,8 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron in let ms = CMethodSignature.mk procname None [] (Typ.void, Annot.Item.empty) [] - decl_info.Clang_ast_t.di_source_range ProcAttributes.C_FUNCTION - trans_unit_ctx.CFrontend_config.lang None None None `None + decl_info.Clang_ast_t.di_source_range ProcAttributes.C_FUNCTION None None None + `None in let stmt_info = { si_pointer= CAst_utils.get_fresh_pointer () diff --git a/infer/src/clang/cMethodSignature.ml b/infer/src/clang/cMethodSignature.ml index 124e22fc8..9536297c9 100644 --- a/infer/src/clang/cMethodSignature.ml +++ b/infer/src/clang/cMethodSignature.ml @@ -33,7 +33,6 @@ type t = ; method_kind: ProcAttributes.clang_method_kind ; is_cpp_virtual: bool ; is_cpp_nothrow: bool - ; lang: CFrontend_config.clang_lang ; pointer_to_parent: Clang_ast_t.pointer option ; pointer_to_property_opt: Clang_ast_t.pointer option ; (* If set then method is a getter/setter *) @@ -52,7 +51,7 @@ let is_setter {pointer_to_property_opt; params} = let mk name class_param params ret_type attributes loc method_kind ?is_cpp_virtual ?is_cpp_nothrow - lang pointer_to_parent pointer_to_property_opt return_param_typ access = + pointer_to_parent pointer_to_property_opt return_param_typ access = let is_cpp_virtual = Option.value is_cpp_virtual ~default:false in let is_cpp_nothrow = Option.value is_cpp_nothrow ~default:false in { name @@ -65,7 +64,6 @@ let mk name class_param params ret_type attributes loc method_kind ?is_cpp_virtu ; method_kind ; is_cpp_virtual ; is_cpp_nothrow - ; lang ; pointer_to_parent ; pointer_to_property_opt ; return_param_typ } diff --git a/infer/src/clang/cMethodSignature.mli b/infer/src/clang/cMethodSignature.mli index ac687fe29..207d0dc33 100644 --- a/infer/src/clang/cMethodSignature.mli +++ b/infer/src/clang/cMethodSignature.mli @@ -26,7 +26,6 @@ type t = ; method_kind: ProcAttributes.clang_method_kind ; is_cpp_virtual: bool ; is_cpp_nothrow: bool - ; lang: CFrontend_config.clang_lang ; pointer_to_parent: Clang_ast_t.pointer option ; pointer_to_property_opt: Clang_ast_t.pointer option ; (* If set then method is a getter/setter *) @@ -39,9 +38,8 @@ val is_setter : t -> bool val mk : Typ.Procname.t -> param_type option -> param_type list -> Typ.t * Annot.Item.t -> Clang_ast_t.attribute list -> Clang_ast_t.source_range -> ProcAttributes.clang_method_kind - -> ?is_cpp_virtual:bool -> ?is_cpp_nothrow:bool -> CFrontend_config.clang_lang - -> Clang_ast_t.pointer option -> Clang_ast_t.pointer option -> Typ.t option - -> Clang_ast_t.access_specifier -> t + -> ?is_cpp_virtual:bool -> ?is_cpp_nothrow:bool -> Clang_ast_t.pointer option + -> Clang_ast_t.pointer option -> Typ.t option -> Clang_ast_t.access_specifier -> t val pp : Format.formatter -> t -> unit diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 70f00921a..117ac5d0f 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -58,7 +58,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s | Typ.Procname.ObjC_Cpp objc_cpp -> let class_name = Typ.Procname.ObjC_Cpp.get_class_type_name objc_cpp in CTrans_models.get_predefined_model_method_signature class_name selector - CType_decl.CProcname.NoAstDecl.objc_method_of_string_kind CFrontend_config.ObjC + CType_decl.CProcname.NoAstDecl.objc_method_of_string_kind | _ -> None in diff --git a/infer/src/clang/cTrans_models.ml b/infer/src/clang/cTrans_models.ml index 3d393b40c..9ef972856 100644 --- a/infer/src/clang/cTrans_models.ml +++ b/infer/src/clang/cTrans_models.ml @@ -64,8 +64,8 @@ let is_assert_log pname = false -let get_predefined_ms_method condition class_name method_name method_kind mk_procname lang - arguments return_type attributes builtin = +let get_predefined_ms_method condition class_name method_name method_kind mk_procname arguments + return_type attributes builtin = if condition then let procname = match builtin with @@ -77,13 +77,13 @@ let get_predefined_ms_method condition class_name method_name method_kind mk_pro let ms = CMethodSignature.mk procname None arguments return_type attributes (CAst_utils.dummy_source_range ()) - ProcAttributes.C_FUNCTION lang None None None `None + ProcAttributes.C_FUNCTION None None None `None in Some ms else None -let get_predefined_ms_stringWithUTF8String class_name method_name mk_procname lang = +let get_predefined_ms_stringWithUTF8String class_name method_name mk_procname = let condition = class_equal class_name CFrontend_config.nsstring_cl && String.equal method_name CFrontend_config.string_with_utf8_m @@ -96,21 +96,21 @@ let get_predefined_ms_stringWithUTF8String class_name method_name mk_procname la let param_name = Mangled.from_string "x" in let params = [CMethodSignature.mk_param_type param_name char_star_type] in get_predefined_ms_method condition class_name method_name Typ.Procname.ObjC_Cpp.ObjCClassMethod - mk_procname lang params (id_type, Annot.Item.empty) [] None + mk_procname params (id_type, Annot.Item.empty) [] None -let get_predefined_ms_is_kind_of_class class_name method_name mk_procname lang = +let get_predefined_ms_is_kind_of_class class_name method_name mk_procname = let condition = String.equal method_name CFrontend_config.is_kind_of_class in let class_type = CType_to_sil_type.type_of_builtin_type_kind `ObjCClass in let name = Mangled.from_string CFrontend_config.self in let params = [CMethodSignature.mk_param_type name class_type] in let bool_type = CType_to_sil_type.type_of_builtin_type_kind `Bool in get_predefined_ms_method condition class_name method_name - Typ.Procname.ObjC_Cpp.ObjCInstanceMethod mk_procname lang params (bool_type, Annot.Item.empty) - [] (Some BuiltinDecl.__instanceof) + Typ.Procname.ObjC_Cpp.ObjCInstanceMethod mk_procname params (bool_type, Annot.Item.empty) [] + (Some BuiltinDecl.__instanceof) -let get_predefined_model_method_signature class_name method_name mk_procname lang = - let next_predefined f = function Some _ as x -> x | None -> f method_name mk_procname lang in +let get_predefined_model_method_signature class_name method_name mk_procname = + let next_predefined f = function Some _ as x -> x | None -> f method_name mk_procname in None |> next_predefined (get_predefined_ms_stringWithUTF8String class_name) |> next_predefined (get_predefined_ms_is_kind_of_class class_name) diff --git a/infer/src/clang/cTrans_models.mli b/infer/src/clang/cTrans_models.mli index a58ccdd45..bd6c80db9 100644 --- a/infer/src/clang/cTrans_models.mli +++ b/infer/src/clang/cTrans_models.mli @@ -29,4 +29,4 @@ val is_modeled_attribute : string -> bool val get_predefined_model_method_signature : Typ.Name.t -> string -> (Typ.Name.t -> string -> Typ.Procname.ObjC_Cpp.kind -> Typ.Procname.t) - -> CFrontend_config.clang_lang -> CMethodSignature.t option + -> CMethodSignature.t option