diff --git a/infer/src/clang/cFrontend_decl.ml b/infer/src/clang/cFrontend_decl.ml index 4d5b4847a..0ee661678 100644 --- a/infer/src/clang/cFrontend_decl.ml +++ b/infer/src/clang/cFrontend_decl.ml @@ -70,15 +70,15 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron try let captured_vars, outer_context_opt = match block_data_opt with - | Some (outer_context, _, _, captured_vars) -> + | Some {CModule_type.captured_vars; context= outer_context} -> (captured_vars, Some outer_context) | None -> ([], None) in let procname, block_return_type = match block_data_opt with - | Some (_, block_return_type, procname, _) -> - (procname, Some block_return_type) + | Some {CModule_type.procname; return_type} -> + (procname, Some return_type) | _ -> (CType_decl.CProcname.from_decl ~tenv func_decl, None) in diff --git a/infer/src/clang/cModule_type.ml b/infer/src/clang/cModule_type.ml index ae524d650..9b074fb36 100644 --- a/infer/src/clang/cModule_type.ml +++ b/infer/src/clang/cModule_type.ml @@ -7,7 +7,11 @@ open! IStd -type block_data = CContext.t * Clang_ast_t.qual_type * Procname.t * (Pvar.t * Typ.t) list +type block_data = + { captured_vars: (Pvar.t * Typ.t) list + ; context: CContext.t + ; procname: Procname.t + ; return_type: Clang_ast_t.qual_type } type instr_type = [`ClangStmt of Clang_ast_t.stmt | `CXXConstructorInit of Clang_ast_t.cxx_ctor_initializer] diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index c095ebf7d..e6737dc9b 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -2776,16 +2776,17 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s match decl with | Clang_ast_t.BlockDecl (_, block_decl_info) -> let open CContext in - let block_return_type = expr_info.Clang_ast_t.ei_qual_type in - let block_pname = - CType_decl.CProcname.from_decl decl ~tenv:context.tenv ~block_return_type ~outer_proc + let return_type = expr_info.Clang_ast_t.ei_qual_type in + let procname = + CType_decl.CProcname.from_decl decl ~tenv:context.tenv ~block_return_type:return_type + ~outer_proc in - let captured_pvars = + let captured_vars = CVar_decl.captured_vars_from_block_info context stmt_info.Clang_ast_t.si_source_range block_decl_info.Clang_ast_t.bdi_captured_variables in - let res = closure_trans block_pname captured_pvars context stmt_info expr_info in - let block_data = Some (context, block_return_type, block_pname, captured_pvars) in + let res = closure_trans procname captured_vars context stmt_info expr_info in + let block_data = Some {CModule_type.captured_vars; context; procname; return_type} in F.function_decl context.translation_unit_context context.tenv context.cfg decl block_data ; res | _ ->