diff --git a/facebook-clang-plugins b/facebook-clang-plugins index 63db8d4a8..ea5e6c489 160000 --- a/facebook-clang-plugins +++ b/facebook-clang-plugins @@ -1 +1 @@ -Subproject commit 63db8d4a883c5ae356c23eec85e520a0d2c9660d +Subproject commit ea5e6c489aff5924f0fdeeb1270ee4a878492c8f diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index a3617810a..2dd1261b9 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -656,11 +656,17 @@ let get_procname_from_cpp_lambda context dec = -> let name_info, decl_ptr, _ = CAst_utils.get_info_from_decl_ref dr in create_procdesc_with_pointer context decl_ptr None name_info.ni_name | _ - -> assert false (* We should not get here *) ) + -> (* We should not get here *) assert false ) | _ - -> assert false + -> (* We should not get here *) assert false + +let get_captures_from_cpp_lambda dec = + match dec with + | Clang_ast_t.CXXRecordDecl (_, _, _, _, _, _, _, cxx_rdi) + -> cxx_rdi.xrdi_lambda_captures + | _ + -> (* We should not get here *) assert false -(* We should not get here *) (* let instance_to_method_call_type instance = if instance then MCVirtual diff --git a/infer/src/clang/cMethod_trans.mli b/infer/src/clang/cMethod_trans.mli index c7f6d02b1..6f2a41c55 100644 --- a/infer/src/clang/cMethod_trans.mli +++ b/infer/src/clang/cMethod_trans.mli @@ -59,3 +59,5 @@ val add_default_method_for_class : CFrontend_config.translation_unit_context -> Typ.Name.t -> Clang_ast_t.decl_info -> unit val get_procname_from_cpp_lambda : CContext.t -> Clang_ast_t.decl -> Typ.Procname.t + +val get_captures_from_cpp_lambda : Clang_ast_t.decl -> Clang_ast_t.lambda_capture_info list diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index f8277aa22..0987353eb 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -2572,7 +2572,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s | _ -> assert false - and lambdaExpr_trans trans_state stmt_info expr_info {Clang_ast_t.lei_lambda_decl; lei_captures} = + and lambdaExpr_trans trans_state stmt_info expr_info {Clang_ast_t.lei_lambda_decl} = let open CContext in let qual_type = expr_info.Clang_ast_t.ei_qual_type in let context = trans_state.context in @@ -2611,6 +2611,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s | None, Some _ -> L.die InternalError "Capture-init with init, but no capture" in + let lei_captures = CMethod_trans.get_captures_from_cpp_lambda lei_lambda_decl in let trans_results, captured_vars = List.fold_right ~f:translate_captured ~init:([], []) lei_captures in