[clang] mark crash sites as `unimplemented` or `incorrect_assumption`

Summary: Found places where these asserts triggered.

Reviewed By: dulmarod

Differential Revision: D5954455

fbshipit-source-id: 1f5907c
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent 22aca7494b
commit 1b6c77b624

@ -119,7 +119,10 @@ let get_var_name_mangled name_info var_decl_info =
| "", Some index | "", Some index
-> "__param_" ^ string_of_int index -> "__param_" ^ string_of_int index
| "", None | "", None
-> assert false -> CFrontend_config.incorrect_assumption
"Got both empty clang_name and None for param_idx in get_var_name_mangled (%a) (%a)"
(Pp.to_string ~f:Clang_ast_j.string_of_named_decl_info) name_info
(Pp.to_string ~f:Clang_ast_j.string_of_var_decl_info) var_decl_info
| _ | _
-> clang_name -> clang_name
in in

@ -804,13 +804,10 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| `CXXMethod | `CXXConversion | `CXXConstructor | `CXXDestructor | `CXXMethod | `CXXConversion | `CXXConstructor | `CXXDestructor
-> method_deref_trans trans_state pre_trans_result decl_ref stmt_info decl_kind -> method_deref_trans trans_state pre_trans_result decl_ref stmt_info decl_kind
| _ | _
-> let print_error decl_kind = -> CFrontend_config.unimplemented
L.(debug Capture Medium) "Decl ref expression %a with pointer %d still needs to be translated"
"Warning: Decl ref expression %s with pointer %d still needs to be translated " (Pp.to_string ~f:Clang_ast_j.string_of_decl_kind) decl_kind
(Clang_ast_j.string_of_decl_kind decl_kind) decl_ref.Clang_ast_t.dr_decl_pointer decl_ref.Clang_ast_t.dr_decl_pointer
in
print_error decl_kind ;
assert false
and declRefExpr_trans trans_state stmt_info decl_ref_expr_info _ = and declRefExpr_trans trans_state stmt_info decl_ref_expr_info _ =
L.(debug Capture Verbose) L.(debug Capture Verbose)
@ -3274,11 +3271,12 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| SubstNonTypeTemplateParmExpr _ | SubstNonTypeTemplateParmExpr _
| SubstNonTypeTemplateParmPackExpr _ | SubstNonTypeTemplateParmPackExpr _
| CXXDependentScopeMemberExpr _ | CXXDependentScopeMemberExpr _
-> raise -> CFrontend_config.unimplemented "Translation of templated code is unsupported: %a"
(CFrontend_config.unimplemented "Translation of templated code is unsupported: %a" (Pp.to_string ~f:Clang_ast_j.string_of_stmt) instr
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) instr)
| ForStmt (_, _) | WhileStmt (_, _) | DoStmt (_, _) | ObjCForCollectionStmt (_, _) | ForStmt (_, _) | WhileStmt (_, _) | DoStmt (_, _) | ObjCForCollectionStmt (_, _)
-> assert false -> CFrontend_config.incorrect_assumption "Unexpected shape for %a: %a"
(Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) instr
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) instr
| MSAsmStmt _ | MSAsmStmt _
| CapturedStmt _ | CapturedStmt _
| CoreturnStmt _ | CoreturnStmt _
@ -3368,10 +3366,9 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| SEHLeaveStmt _ | SEHLeaveStmt _
| SEHTryStmt _ | SEHTryStmt _
| DefaultStmt _ | DefaultStmt _
-> raise -> CFrontend_config.unimplemented "Statement translation for kind %s: %a"
(CFrontend_config.unimplemented "Statement translation for kind %s: %a" (Clang_ast_proj.get_stmt_kind_string instr) (Pp.to_string ~f:Clang_ast_j.string_of_stmt)
(Clang_ast_proj.get_stmt_kind_string instr) instr
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) instr)
(* Function similar to instruction function, but it takes C++ constructor initializer as (* Function similar to instruction function, but it takes C++ constructor initializer as
an input parameter. *) an input parameter. *)

Loading…
Cancel
Save