From a54b2d03f6582c526569148c22fa9dabec5a8ea9 Mon Sep 17 00:00:00 2001 From: Dulma Rodriguez Date: Wed, 9 Dec 2015 09:14:58 -0800 Subject: [PATCH] Remove unused code from ast_expressions Summary: public These methods are now unused. Reviewed By: akotulski Differential Revision: D2739315 fb-gh-sync-id: 4cefebb --- infer/src/clang/ast_expressions.ml | 87 ----------------------------- infer/src/clang/ast_expressions.mli | 16 ------ 2 files changed, 103 deletions(-) diff --git a/infer/src/clang/ast_expressions.ml b/infer/src/clang/ast_expressions.ml index a4d322c91..68f9f4903 100644 --- a/infer/src/clang/ast_expressions.ml +++ b/infer/src/clang/ast_expressions.ml @@ -31,26 +31,6 @@ let fresh_stmt_info stmt_info = let fresh_decl_info decl_info = { decl_info with Clang_ast_t.di_pointer = Ast_utils.get_fresh_pointer () } -let dummy_decl_info decl_info = { - decl_info with - Clang_ast_t.di_pointer = Ast_utils.get_fresh_pointer (); - di_source_range = dummy_source_range (); -} - -let dummy_decl_info_in_curr_file decl_info = - let source_loc = { - Clang_ast_t.sl_file = Some (DB.source_file_to_abs_path !CLocation.current_source_file); - sl_line = None; - sl_column = None; - } in { - decl_info with - Clang_ast_t.di_pointer = Ast_utils.get_fresh_pointer (); - di_source_range = - if !CFrontend_config.testing_mode then - decl_info.Clang_ast_t.di_source_range - else (source_loc, source_loc); - } - let empty_decl_info = { Clang_ast_t.di_pointer = ""; di_parent_pointer = None; @@ -194,12 +174,6 @@ let make_expr_info tp vk objc_kind = { let make_expr_info_with_objc_kind tp objc_kind = make_expr_info tp `LValue objc_kind -let make_lvalue_obc_prop_expr_info tp = - make_expr_info tp `LValue `ObjCProperty - -let make_method_decl_info mdi body = - { mdi with Clang_ast_t.omdi_body = Some body; } - let make_decl_ref_exp stmt_info expr_info drei = let stmt_info = { Clang_ast_t.si_pointer = Ast_utils.get_fresh_pointer (); @@ -238,62 +212,11 @@ let make_decl_ref_no_tp k decl_ptr name is_hidden = let make_decl_ref_invalid k name is_hidden tp = make_decl_ref k (Ast_utils.get_invalid_pointer ()) name is_hidden (Some tp) -let make_decl_ref_self ptr tp = { - Clang_ast_t.dr_kind = `ImplicitParam; - dr_decl_pointer = ptr; - dr_name = Some (Ast_utils.make_name_decl "self"); - dr_is_hidden = false ; - dr_type_ptr = Some tp -} - let make_decl_ref_expr_info decl_ref = { Clang_ast_t.drti_decl_ref = Some decl_ref; drti_found_decl_ref = None; } -let make_obj_c_ivar_ref_expr_info k ptr n tp = { - Clang_ast_t.ovrei_decl_ref = make_decl_ref_tp k ptr n false tp; - ovrei_pointer = Ast_utils.get_fresh_pointer (); - ovrei_is_free_ivar = true; -} - -(* Build an AST cast expression of a decl_ref_expr *) -let make_cast_expr tp di decl_ref_expr_info objc_kind = - let expr_info = make_expr_info tp `RValue objc_kind in - let stmt_info = make_stmt_info di in - let decl_ref_exp = make_decl_ref_exp stmt_info expr_info decl_ref_expr_info in - let cast_expr = { - Clang_ast_t.cei_cast_kind = `LValueToRValue; - cei_base_path = []; - } in - let cast_exp_rhs = - Clang_ast_t.ImplicitCastExpr(stmt_info, [decl_ref_exp], expr_info, cast_expr) in - cast_exp_rhs - -(* Build AST expression self.field_name as `LValue *) -let make_self_field class_type di tp field_name = - let tp_class = create_pointer_type (create_class_type class_type) in - let expr_info = make_expr_info_with_objc_kind tp `ObjCProperty in - let stmt_info = make_stmt_info di in - let cast_exp = make_cast_expr tp_class di (make_decl_ref_expr_info (make_decl_ref_self di.Clang_ast_t.di_pointer tp_class)) `ObjCProperty in - let obj_c_ivar_ref_expr_info = make_obj_c_ivar_ref_expr_info (`ObjCIvar) di.Clang_ast_t.di_pointer field_name tp in - let ivar_ref_exp = - Clang_ast_t.ObjCIvarRefExpr(stmt_info, [cast_exp], expr_info, obj_c_ivar_ref_expr_info) in - ivar_ref_exp - -(* Build AST expression for self.field_name casted as `RValue. *) -let make_deref_self_field class_decl_opt di tp field_name = - let stmt_info = make_stmt_info di in - let ivar_ref_exp = make_self_field class_decl_opt di tp field_name in - let expr_info' = make_expr_info tp `RValue `ObjCProperty in - let cast_exp_info = { - Clang_ast_t.cei_cast_kind = `LValueToRValue; - cei_base_path = []; - } in - let cast_exp' = - Clang_ast_t.ImplicitCastExpr(stmt_info, [ivar_ref_exp], expr_info', cast_exp_info) in - cast_exp' - let make_objc_ivar_decl decl_info tp property_impl_decl_info ivar_name = let field_decl_info = { Clang_ast_t.fldi_is_mutable = true; @@ -323,12 +246,6 @@ let make_ObjCBoolLiteralExpr stmt_info value = let ei = make_expr_info create_BOOL_type in Clang_ast_t.ObjCBoolLiteralExpr((fresh_stmt_info stmt_info),[], ei, value) -let make_decl_ref_exp_var (var_name, var_tp, var_ptr) var_kind stmt_info = - let stmt_info = stmt_info_with_fresh_pointer stmt_info in - let decl_ref = make_decl_ref_tp var_kind var_ptr var_name false var_tp in - let expr_info = make_expr_info var_tp in - make_decl_ref_exp stmt_info expr_info (make_decl_ref_expr_info decl_ref) - let make_message_expr param_tp selector decl_ref_exp stmt_info add_cast = let stmt_info = stmt_info_with_fresh_pointer stmt_info in let parameters = @@ -340,10 +257,6 @@ let make_message_expr param_tp selector decl_ref_exp stmt_info add_cast = let expr_info = make_expr_info_with_objc_kind param_tp `ObjCProperty in Clang_ast_t.ObjCMessageExpr (stmt_info, parameters, expr_info, obj_c_message_expr_info) -let make_compound_stmt stmts stmt_info = - let stmt_info = stmt_info_with_fresh_pointer stmt_info in - Clang_ast_t.CompoundStmt (stmt_info, stmts) - let make_binary_stmt stmt1 stmt2 stmt_info expr_info boi = let stmt_info = stmt_info_with_fresh_pointer stmt_info in Clang_ast_t.BinaryOperator(stmt_info, [stmt1; stmt2], expr_info, boi) diff --git a/infer/src/clang/ast_expressions.mli b/infer/src/clang/ast_expressions.mli index 7aefdcca3..e06fecc3b 100644 --- a/infer/src/clang/ast_expressions.mli +++ b/infer/src/clang/ast_expressions.mli @@ -13,10 +13,6 @@ open Clang_ast_t val dummy_stmt : unit -> stmt -val dummy_decl_info : decl_info -> decl_info - -val dummy_decl_info_in_curr_file : decl_info -> decl_info - val dummy_source_range : unit -> source_range val dummy_stmt_info : unit -> stmt_info @@ -50,12 +46,8 @@ val create_pointer_type : type_ptr -> type_ptr val make_objc_ivar_decl : decl_info -> type_ptr -> obj_c_property_impl_decl_info -> named_decl_info -> decl -val make_deref_self_field : string -> decl_info -> type_ptr -> named_decl_info -> stmt - val make_stmt_info : decl_info -> stmt_info -val make_method_decl_info : obj_c_method_decl_info -> stmt -> obj_c_method_decl_info - val make_decl_ref_tp : decl_kind -> pointer -> named_decl_info -> bool -> type_ptr -> decl_ref val make_decl_ref_expr_info : decl_ref -> decl_ref_expr_info @@ -64,10 +56,6 @@ val make_general_expr_info : type_ptr -> value_kind -> object_kind -> expr_info val make_expr_info : type_ptr -> expr_info -val make_cast_expr : type_ptr -> decl_info -> decl_ref_expr_info -> object_kind -> stmt - -val make_self_field : string -> decl_info -> type_ptr -> named_decl_info -> stmt - val make_next_object_exp : stmt_info -> stmt -> Clang_ast_t.stmt -> Clang_ast_t.stmt * Clang_ast_t.stmt @@ -77,10 +65,6 @@ val create_implicit_cast_expr : stmt_info -> stmt list -> type_ptr -> cast_kind val make_message_expr : type_ptr -> string -> stmt -> stmt_info -> bool -> stmt -val make_compound_stmt : stmt list -> stmt_info -> stmt - -val make_decl_ref_exp_var : named_decl_info * type_ptr * pointer -> decl_kind -> stmt_info -> stmt - val make_binary_stmt : stmt -> stmt -> stmt_info -> expr_info -> binary_operator_info -> stmt val make_obj_c_message_expr_info_class : string -> string -> pointer option ->