|
|
@ -164,18 +164,17 @@ let make_name_decl name = {
|
|
|
|
Clang_ast_t.ni_qual_name = [name];
|
|
|
|
Clang_ast_t.ni_qual_name = [name];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let make_general_decl_ref k name is_hidden qt = {
|
|
|
|
let make_general_decl_ref k decl_ptr name is_hidden qt = {
|
|
|
|
Clang_ast_t.dr_kind = k;
|
|
|
|
Clang_ast_t.dr_kind = k;
|
|
|
|
|
|
|
|
Clang_ast_t.dr_decl_pointer = decl_ptr;
|
|
|
|
Clang_ast_t.dr_name = Some (make_name_decl name);
|
|
|
|
Clang_ast_t.dr_name = Some (make_name_decl name);
|
|
|
|
Clang_ast_t.dr_is_hidden = is_hidden ;
|
|
|
|
Clang_ast_t.dr_is_hidden = is_hidden ;
|
|
|
|
Clang_ast_t.dr_qual_type = Some (qt)
|
|
|
|
Clang_ast_t.dr_qual_type = Some (qt)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let make_decl_ref name =
|
|
|
|
let make_decl_ref_self ptr qt = {
|
|
|
|
make_general_decl_ref (`Var) name false (create_int_type ())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let make_decl_ref_self qt = {
|
|
|
|
|
|
|
|
Clang_ast_t.dr_kind = `ImplicitParam;
|
|
|
|
Clang_ast_t.dr_kind = `ImplicitParam;
|
|
|
|
|
|
|
|
Clang_ast_t.dr_decl_pointer = ptr;
|
|
|
|
Clang_ast_t.dr_name = Some (make_name_decl "self");
|
|
|
|
Clang_ast_t.dr_name = Some (make_name_decl "self");
|
|
|
|
Clang_ast_t.dr_is_hidden = false ;
|
|
|
|
Clang_ast_t.dr_is_hidden = false ;
|
|
|
|
Clang_ast_t.dr_qual_type = Some qt
|
|
|
|
Clang_ast_t.dr_qual_type = Some qt
|
|
|
@ -186,8 +185,8 @@ let make_decl_ref_expr_info decl_ref = {
|
|
|
|
Clang_ast_t.drti_found_decl_ref = None;
|
|
|
|
Clang_ast_t.drti_found_decl_ref = None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let make_obj_c_ivar_ref_expr_info k n qt = {
|
|
|
|
let make_obj_c_ivar_ref_expr_info k ptr n qt = {
|
|
|
|
Clang_ast_t.ovrei_decl_ref = make_general_decl_ref k n false qt;
|
|
|
|
Clang_ast_t.ovrei_decl_ref = make_general_decl_ref k ptr n false qt;
|
|
|
|
Clang_ast_t.ovrei_pointer = Ast_utils.get_fresh_pointer ();
|
|
|
|
Clang_ast_t.ovrei_pointer = Ast_utils.get_fresh_pointer ();
|
|
|
|
Clang_ast_t.ovrei_is_free_ivar = true;
|
|
|
|
Clang_ast_t.ovrei_is_free_ivar = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -209,8 +208,9 @@ let make_self_field class_type di qt field_name =
|
|
|
|
let qt_class = create_qual_type class_type in
|
|
|
|
let qt_class = create_qual_type class_type in
|
|
|
|
let expr_info = make_expr_info_with_objc_kind qt `ObjCProperty in
|
|
|
|
let expr_info = make_expr_info_with_objc_kind qt `ObjCProperty in
|
|
|
|
let stmt_info = make_stmt_info di in
|
|
|
|
let stmt_info = make_stmt_info di in
|
|
|
|
let cast_exp = make_cast_expr qt_class di (make_decl_ref_expr_info (make_decl_ref_self qt_class)) `ObjCProperty in
|
|
|
|
let decl_ptr = Ast_utils.get_invalid_pointer() in
|
|
|
|
let obj_c_ivar_ref_expr_info = make_obj_c_ivar_ref_expr_info (`ObjCIvar) field_name qt in
|
|
|
|
let cast_exp = make_cast_expr qt_class di (make_decl_ref_expr_info (make_decl_ref_self decl_ptr qt_class)) `ObjCProperty in
|
|
|
|
|
|
|
|
let obj_c_ivar_ref_expr_info = make_obj_c_ivar_ref_expr_info (`ObjCIvar) decl_ptr field_name qt in
|
|
|
|
let ivar_ref_exp = ObjCIvarRefExpr(stmt_info, [cast_exp], expr_info, obj_c_ivar_ref_expr_info) in
|
|
|
|
let ivar_ref_exp = ObjCIvarRefExpr(stmt_info, [cast_exp], expr_info, obj_c_ivar_ref_expr_info) in
|
|
|
|
ivar_ref_exp
|
|
|
|
ivar_ref_exp
|
|
|
|
|
|
|
|
|
|
|
@ -254,9 +254,9 @@ let make_expr_info qt =
|
|
|
|
Clang_ast_t.ei_object_kind = `ObjCProperty
|
|
|
|
Clang_ast_t.ei_object_kind = `ObjCProperty
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let make_decl_ref_exp_var (var_name, var_qt) var_kind stmt_info =
|
|
|
|
let make_decl_ref_exp_var (var_name, var_qt, var_ptr) var_kind stmt_info =
|
|
|
|
let stmt_info = stmt_info_with_fresh_pointer stmt_info in
|
|
|
|
let stmt_info = stmt_info_with_fresh_pointer stmt_info in
|
|
|
|
let decl_ref = make_general_decl_ref var_kind var_name false var_qt in
|
|
|
|
let decl_ref = make_general_decl_ref var_kind var_ptr var_name false var_qt in
|
|
|
|
let expr_info = make_expr_info var_qt in
|
|
|
|
let expr_info = make_expr_info var_qt in
|
|
|
|
make_decl_ref_exp stmt_info expr_info (make_decl_ref_expr_info decl_ref)
|
|
|
|
make_decl_ref_exp stmt_info expr_info (make_decl_ref_expr_info decl_ref)
|
|
|
|
|
|
|
|
|
|
|
@ -282,8 +282,10 @@ let make_binary_stmt stmt1 stmt2 stmt_info expr_info boi =
|
|
|
|
let make_next_object_exp stmt_info item items =
|
|
|
|
let make_next_object_exp stmt_info item items =
|
|
|
|
let var_decl_ref, var_type =
|
|
|
|
let var_decl_ref, var_type =
|
|
|
|
match item with
|
|
|
|
match item with
|
|
|
|
| DeclStmt (stmt_info, _, [VarDecl(di, var_name, var_type, _)]) ->
|
|
|
|
| DeclStmt (stmt_info, _, [VarDecl(di, name_info, var_type, _)]) ->
|
|
|
|
let decl_ref = make_general_decl_ref `Var var_name.Clang_ast_t.ni_name false var_type in
|
|
|
|
let var_name = name_info.Clang_ast_t.ni_name in
|
|
|
|
|
|
|
|
let decl_ptr = di.Clang_ast_t.di_pointer in
|
|
|
|
|
|
|
|
let decl_ref = make_general_decl_ref `Var decl_ptr var_name false var_type in
|
|
|
|
let stmt_info_var = {
|
|
|
|
let stmt_info_var = {
|
|
|
|
si_pointer = di.Clang_ast_t.di_pointer;
|
|
|
|
si_pointer = di.Clang_ast_t.di_pointer;
|
|
|
|
si_source_range = di.Clang_ast_t.di_source_range
|
|
|
|
si_source_range = di.Clang_ast_t.di_source_range
|
|
|
@ -332,6 +334,7 @@ let translate_dispatch_function block_name stmt_info stmt_list ei n =
|
|
|
|
} in
|
|
|
|
} in
|
|
|
|
let decl_ref = {
|
|
|
|
let decl_ref = {
|
|
|
|
dr_kind = `Var;
|
|
|
|
dr_kind = `Var;
|
|
|
|
|
|
|
|
dr_decl_pointer = decl_info.di_pointer;
|
|
|
|
dr_name = Some block_name_info;
|
|
|
|
dr_name = Some block_name_info;
|
|
|
|
dr_is_hidden = false;
|
|
|
|
dr_is_hidden = false;
|
|
|
|
dr_qual_type = Some qt;
|
|
|
|
dr_qual_type = Some qt;
|
|
|
@ -353,14 +356,14 @@ let trans_negation_with_conditional stmt_info expr_info stmt_list =
|
|
|
|
let stmt_list_cond = stmt_list @ [create_integer_literal stmt_info "0"] @ [create_integer_literal stmt_info "1"] in
|
|
|
|
let stmt_list_cond = stmt_list @ [create_integer_literal stmt_info "0"] @ [create_integer_literal stmt_info "1"] in
|
|
|
|
ConditionalOperator(stmt_info, stmt_list_cond, expr_info)
|
|
|
|
ConditionalOperator(stmt_info, stmt_list_cond, expr_info)
|
|
|
|
|
|
|
|
|
|
|
|
let create_call stmt_info function_name qt parameters =
|
|
|
|
let create_call stmt_info decl_pointer function_name qt parameters =
|
|
|
|
let expr_info_call = {
|
|
|
|
let expr_info_call = {
|
|
|
|
Clang_ast_t.ei_qual_type = qt;
|
|
|
|
Clang_ast_t.ei_qual_type = qt;
|
|
|
|
Clang_ast_t.ei_value_kind = `XValue;
|
|
|
|
Clang_ast_t.ei_value_kind = `XValue;
|
|
|
|
Clang_ast_t.ei_object_kind = `Ordinary
|
|
|
|
Clang_ast_t.ei_object_kind = `Ordinary
|
|
|
|
} in
|
|
|
|
} in
|
|
|
|
let expr_info_dre = make_expr_info_with_objc_kind qt `Ordinary in
|
|
|
|
let expr_info_dre = make_expr_info_with_objc_kind qt `Ordinary in
|
|
|
|
let decl_ref = make_general_decl_ref `Function function_name false qt in
|
|
|
|
let decl_ref = make_general_decl_ref `Function decl_pointer function_name false qt in
|
|
|
|
let decl_ref_info = make_decl_ref_expr_info decl_ref in
|
|
|
|
let decl_ref_info = make_decl_ref_expr_info decl_ref in
|
|
|
|
let decl_ref_exp = DeclRefExpr(stmt_info, [], expr_info_dre, decl_ref_info) in
|
|
|
|
let decl_ref_exp = DeclRefExpr(stmt_info, [], expr_info_dre, decl_ref_info) in
|
|
|
|
CallExpr(stmt_info, decl_ref_exp:: parameters, expr_info_call)
|
|
|
|
CallExpr(stmt_info, decl_ref_exp:: parameters, expr_info_call)
|
|
|
@ -368,10 +371,12 @@ let create_call stmt_info function_name qt parameters =
|
|
|
|
let create_assume_not_null_call decl_info var_name var_type =
|
|
|
|
let create_assume_not_null_call decl_info var_name var_type =
|
|
|
|
let stmt_info = stmt_info_with_fresh_pointer (make_stmt_info decl_info) in
|
|
|
|
let stmt_info = stmt_info_with_fresh_pointer (make_stmt_info decl_info) in
|
|
|
|
let boi = { Clang_ast_t.boi_kind = `NE } in
|
|
|
|
let boi = { Clang_ast_t.boi_kind = `NE } in
|
|
|
|
let decl_ref = make_general_decl_ref `Var var_name false var_type in
|
|
|
|
let decl_ptr = Ast_utils.get_invalid_pointer () in
|
|
|
|
|
|
|
|
let decl_ref = make_general_decl_ref `Var decl_ptr var_name false var_type in
|
|
|
|
let stmt_info_var = dummy_stmt_info () in
|
|
|
|
let stmt_info_var = dummy_stmt_info () in
|
|
|
|
let decl_ref_info = make_decl_ref_expr_info decl_ref in
|
|
|
|
let decl_ref_info = make_decl_ref_expr_info decl_ref in
|
|
|
|
let var_decl_ref = DeclRefExpr(stmt_info_var, [], (make_expr_info var_type), decl_ref_info) in
|
|
|
|
let var_decl_ref = DeclRefExpr(stmt_info_var, [], (make_expr_info var_type), decl_ref_info) in
|
|
|
|
|
|
|
|
let var_decl_ptr = Ast_utils.get_invalid_pointer () in
|
|
|
|
let expr_info = {
|
|
|
|
let expr_info = {
|
|
|
|
Clang_ast_t.ei_qual_type = var_type;
|
|
|
|
Clang_ast_t.ei_qual_type = var_type;
|
|
|
|
Clang_ast_t.ei_value_kind = `RValue;
|
|
|
|
Clang_ast_t.ei_value_kind = `RValue;
|
|
|
@ -382,4 +387,4 @@ let create_assume_not_null_call decl_info var_name var_type =
|
|
|
|
let null_expr = create_integer_literal stmt_info "0" in
|
|
|
|
let null_expr = create_integer_literal stmt_info "0" in
|
|
|
|
let bin_op = make_binary_stmt decl_ref_exp_cast null_expr stmt_info (make_expr_info var_type) boi in
|
|
|
|
let bin_op = make_binary_stmt decl_ref_exp_cast null_expr stmt_info (make_expr_info var_type) boi in
|
|
|
|
let parameters = [bin_op] in
|
|
|
|
let parameters = [bin_op] in
|
|
|
|
create_call stmt_info (Procname.to_string SymExec.ModelBuiltins.__infer_assume) (create_void_type ()) parameters
|
|
|
|
create_call stmt_info var_decl_ptr (Procname.to_string SymExec.ModelBuiltins.__infer_assume) (create_void_type ()) parameters
|
|
|
|