From 7389dfe97654ef26e1c0dc05902bbdb9a2f80878 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Wed, 25 Nov 2015 04:52:21 -0800 Subject: [PATCH] Don't crash when method decl is not found Summary: public Not finding C++ method in decl map was considered impossible to happen. It turns out it can happen because ast exporter wasn't exporting template instantiations. So instead, pick a default when method decl is not found. This will be right in most cases and will allow us to analyze rest of the function without crashing frontend Reviewed By: dulmarod Differential Revision: D2695653 fb-gh-sync-id: 4077c59 --- infer/src/clang/cTrans.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index a58d59e64..58d97cb7f 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -394,7 +394,7 @@ struct let is_instance_method = match CMethod_trans.method_signature_of_pointer decl_ptr with | Some ms -> CMethod_signature.ms_is_instance ms - | _ -> assert false in (* will happen for generated methods, shouldn't happen right now *) + | _ -> true in (* might happen for methods that are not exported yet (some templates). *) let extra_exps = if is_instance_method then ( (* pre_trans_result.exps may contain expr for 'this' parameter:*) (* if it comes from CXXMemberCallExpr it will be there *)