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
master
Andrzej Kotulski 9 years ago committed by facebook-github-bot-7
parent 0441919a42
commit 7389dfe976

@ -394,7 +394,7 @@ struct
let is_instance_method = let is_instance_method =
match CMethod_trans.method_signature_of_pointer decl_ptr with match CMethod_trans.method_signature_of_pointer decl_ptr with
| Some ms -> CMethod_signature.ms_is_instance ms | 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 ( let extra_exps = if is_instance_method then (
(* pre_trans_result.exps may contain expr for 'this' parameter:*) (* pre_trans_result.exps may contain expr for 'this' parameter:*)
(* if it comes from CXXMemberCallExpr it will be there *) (* if it comes from CXXMemberCallExpr it will be there *)

Loading…
Cancel
Save