Update fcp which exports less redundant information

Summary: @​public
We no longer rely on existence of qt_raw field.
Update facebook-clang-plugins so that this field
is not even exported. This should give us some perf wins
since qual_type is written in a lot of places

Reviewed By: @dulmarod

Differential Revision: D2489308
master
Andrzej Kotulski 9 years ago committed by facebook-github-bot-0
parent 514915a833
commit 16604a9e75

@ -1 +1 @@
Subproject commit 7448f0c1a80b1a6f8a2e826c3acafc3df7f9621e Subproject commit 52b5fd8f3c171c2782f243532fd316236e6a0348

@ -76,20 +76,11 @@ let stmt_info_with_fresh_pointer stmt_info = {
si_source_range = stmt_info.Clang_ast_t.si_source_range; si_source_range = stmt_info.Clang_ast_t.si_source_range;
} }
let create_qual_type_with_just_pointer pointer = let create_qual_type_with_just_pointer pointer = pointer
{
Clang_ast_t.qt_raw = "";
qt_desugared = None;
qt_type_ptr = pointer;
}
let get_constant_qual_type s = let get_constant_qual_type s =
let pointer = CFrontend_config.type_pointer_prefix ^ s in let pointer = CFrontend_config.type_pointer_prefix ^ s in
{ pointer
Clang_ast_t.qt_raw = "";
qt_desugared = None;
qt_type_ptr = pointer
}
(* Whenever new type are added manually to the translation here, *) (* Whenever new type are added manually to the translation here, *)
(* they should be added to the map in cTypes_decl too!! *) (* they should be added to the map in cTypes_decl too!! *)
@ -123,26 +114,11 @@ let create_void_unsigned_long_type =
let create_void_void_type = let create_void_void_type =
get_constant_qual_type "void (void *)" get_constant_qual_type "void (void *)"
let create_class_type class_name = let create_class_type class_name = "custom_class_name*" ^ class_name
{
Clang_ast_t.qt_raw = "";
qt_desugared = None;
qt_type_ptr = "custom_class_name*" ^ class_name;
}
let create_struct_type struct_name = let create_struct_type struct_name = "custom_struct_name*" ^ struct_name
{
Clang_ast_t.qt_raw = "";
qt_desugared = None;
qt_type_ptr = "custom_struct_name*" ^ struct_name;
}
let create_pointer_type class_type = let create_pointer_type class_type = "custom_pointer_" ^ class_type
{
Clang_ast_t.qt_raw = "";
qt_desugared = None;
qt_type_ptr = "custom_pointer_"^class_type.Clang_ast_t.qt_type_ptr
}
let create_integer_literal stmt_info n = let create_integer_literal stmt_info n =
let stmt_info = dummy_stmt_info () in let stmt_info = dummy_stmt_info () in

@ -314,12 +314,12 @@ struct
(*TODO take the attributes into account too. To be done after we get the attribute's arguments. *) (*TODO take the attributes into account too. To be done after we get the attribute's arguments. *)
let is_type_nonnull qt attributes = let is_type_nonnull qt attributes =
let open Clang_ast_t in let open Clang_ast_t in
match get_type qt.qt_type_ptr with match get_type qt with
| Some AttributedType (_, attr_info) -> attr_info.ati_attr_kind = `Nonnull | Some AttributedType (_, attr_info) -> attr_info.ati_attr_kind = `Nonnull
| _ -> false | _ -> false
let string_of_qual_type qt = let string_of_qual_type qt =
match get_desugared_type qt.Clang_ast_t.qt_type_ptr with match get_desugared_type qt with
| Some typ -> (Clang_ast_proj.get_type_tuple typ).Clang_ast_t.ti_raw | Some typ -> (Clang_ast_proj.get_type_tuple typ).Clang_ast_t.ti_raw
| None -> "" | None -> ""

@ -170,7 +170,7 @@ and qual_type_ptr_to_sil_type translate_decl tenv type_ptr =
| _ -> Sil.Tvoid | _ -> Sil.Tvoid
and qual_type_to_sil_type translate_decl tenv qt = and qual_type_to_sil_type translate_decl tenv qt =
let type_ptr = qt.Clang_ast_t.qt_type_ptr in let type_ptr = qt in
match custom_qual_type_to_sil_type type_ptr with match custom_qual_type_to_sil_type type_ptr with
| Some typ -> typ | Some typ -> typ
| None -> qual_type_ptr_to_sil_type translate_decl tenv type_ptr | None -> qual_type_ptr_to_sil_type translate_decl tenv type_ptr

@ -42,11 +42,6 @@ let lookup_var_type context pvar =
(Sil.pvar_to_string pvar); (Sil.pvar_to_string pvar);
Sil.Tvoid Sil.Tvoid
let get_desugared_type t =
match t.Clang_ast_t.qt_desugared with
| Some t' -> t'
| _ -> assert false
let get_name_from_struct s = let get_name_from_struct s =
match s with match s with
| Sil.Tstruct(_, _, _, Some n, _, _, _) -> n | Sil.Tstruct(_, _, _, Some n, _, _, _) -> n
@ -127,11 +122,11 @@ let rec return_type_of_function_type_ptr type_ptr =
"" ""
let return_type_of_function_type qt = let return_type_of_function_type qt =
return_type_of_function_type_ptr qt.Clang_ast_t.qt_type_ptr return_type_of_function_type_ptr qt
let is_block_type qt = let is_block_type qt =
let open Clang_ast_t in let open Clang_ast_t in
match Ast_utils.get_desugared_type qt.Clang_ast_t.qt_type_ptr with match Ast_utils.get_desugared_type qt with
| Some BlockPointerType _ -> true | Some BlockPointerType _ -> true
| _ -> false | _ -> false

@ -38,13 +38,13 @@ let add_predefined_basic_types tenv =
let open Clang_ast_t in let open Clang_ast_t in
let add_basic_type qt basic_type_kind = let add_basic_type qt basic_type_kind =
let sil_type = CType_to_sil_type.sil_type_of_builtin_type_kind basic_type_kind in let sil_type = CType_to_sil_type.sil_type_of_builtin_type_kind basic_type_kind in
Ast_utils.update_sil_types_map qt.Clang_ast_t.qt_type_ptr sil_type in Ast_utils.update_sil_types_map qt sil_type in
let add_pointer_type qt sil_type = let add_pointer_type qt sil_type =
let pointer_type = CTypes.add_pointer_to_typ sil_type in let pointer_type = CTypes.add_pointer_to_typ sil_type in
Ast_utils.update_sil_types_map qt.Clang_ast_t.qt_type_ptr pointer_type in Ast_utils.update_sil_types_map qt pointer_type in
let add_function_type qt return_type = let add_function_type qt return_type =
(* We translate function types as the return type of the function *) (* We translate function types as the return type of the function *)
Ast_utils.update_sil_types_map qt.Clang_ast_t.qt_type_ptr return_type in Ast_utils.update_sil_types_map qt return_type in
let sil_void_type = CType_to_sil_type.sil_type_of_builtin_type_kind `Void in let sil_void_type = CType_to_sil_type.sil_type_of_builtin_type_kind `Void in
let sil_char_type = CType_to_sil_type.sil_type_of_builtin_type_kind `Char_S in let sil_char_type = CType_to_sil_type.sil_type_of_builtin_type_kind `Char_S in
let sil_nsarray_type = Sil.Tvar (CTypes.mk_classname CFrontend_config.nsarray_cl) in let sil_nsarray_type = Sil.Tvar (CTypes.mk_classname CFrontend_config.nsarray_cl) in

Loading…
Cancel
Save