From 56f3fb4f4b59f868a37adec9b84414e829716394 Mon Sep 17 00:00:00 2001 From: Dulma Rodriguez Date: Mon, 26 Oct 2015 06:25:49 -0700 Subject: [PATCH] Translating structs and C++ classes only on demand Summary: public Translating structs and C++ classes only on demand. This reduces the size of the tenv and saves analysis time. Reviewed By: ddino Differential Revision: D2575008 fb-gh-sync-id: b29da2a --- infer/src/clang/cFrontend.ml | 1 - infer/src/clang/cTypes_decl.ml | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/infer/src/clang/cFrontend.ml b/infer/src/clang/cFrontend.ml index 097353968..772b88928 100644 --- a/infer/src/clang/cFrontend.ml +++ b/infer/src/clang/cFrontend.ml @@ -38,7 +38,6 @@ let rec translate_one_declaration tenv cg cfg namespace parent_dec dec = (* Currently C/C++ record decl treated in the same way *) | CXXRecordDecl (_, _, _, _, decl_list, _, _, _) | RecordDecl (_, _, _, _, decl_list, _, _) -> - ignore (CTypes_decl.add_types_from_decl_to_tenv tenv namespace dec); let method_decls = CTypes_decl.get_method_decls dec decl_list in let tranlate_method (parent, decl) = translate_one_declaration tenv cg cfg namespace parent decl in diff --git a/infer/src/clang/cTypes_decl.ml b/infer/src/clang/cTypes_decl.ml index 9ee5ae078..6385917b9 100644 --- a/infer/src/clang/cTypes_decl.ml +++ b/infer/src/clang/cTypes_decl.ml @@ -29,7 +29,11 @@ let add_predefined_objc_types tenv = Sil.TN_csu (Sil.Struct, Mangled.from_string CFrontend_config.objc_object) in let id_typedef = Sil.Tvar (typename_objc_object) in let id_typename = CType_to_sil_type.get_builtin_objc_typename `ObjCId in - Sil.tenv_add tenv id_typename id_typedef + Sil.tenv_add tenv id_typename id_typedef; + let objc_object_type_info = + Sil.Tstruct ([], [], Sil.Struct, + Some (Mangled.from_string CFrontend_config.objc_object), [], [], []) in + Sil.tenv_add tenv typename_objc_object objc_object_type_info (* Whenever new type are added manually to the translation in ast_expressions, *) (* they should be added here too!! *)