Fix naming problems with template methods

Summary:
public there was a problem with
templated method names that had '/' in its names.
This happened for names like this: `method_name<(anonymous lambda in path/to/src:1:1)>`

Plus random fix to backend logging

Reviewed By: dulmarod

Differential Revision: D2749359

fb-gh-sync-id: b9a0fcd
master
Andrzej Kotulski 9 years ago committed by facebook-github-bot-1
parent 4d23334abd
commit 6d9c5c684e

@ -192,7 +192,7 @@ let file_data_to_cfg exe_env file_data =
| None ->
let cfg = match Cfg.load_cfg_from_file file_data.cfg_file with
| None ->
L.err "Cannot find cfg for %s@." (DB.filename_to_string file_data.tenv_file);
L.err "Cannot find cfg for %s@." (DB.filename_to_string file_data.cfg_file);
assert false
| Some cfg -> cfg in
file_data.cfg <- Some cfg;

@ -154,6 +154,12 @@ struct
let get_qualified_name name_info =
fold_qual_name name_info.Clang_ast_t.ni_qual_name
let get_unqualified_name name_info =
let name = match name_info.Clang_ast_t.ni_qual_name with
| name :: quals -> name
| [] -> name_info.Clang_ast_t.ni_name in
fold_qual_name [name]
let get_class_name_from_member member_name_info =
match member_name_info.Clang_ast_t.ni_qual_name with
| _ :: class_qual_list -> fold_qual_name class_qual_list

@ -83,9 +83,12 @@ sig
val get_enum_constant_exp : Clang_ast_t.pointer -> Clang_ast_t.pointer option * Sil.exp option
(** returns fully qualified name given name info *)
(** returns sanitized, fully qualified name given name info *)
val get_qualified_name : Clang_ast_t.named_decl_info -> string
(** returns sanitized unqualified name given name info *)
val get_unqualified_name : Clang_ast_t.named_decl_info -> string
(** returns qualified class name given member name info *)
val get_class_name_from_member : Clang_ast_t.named_decl_info -> string

@ -125,7 +125,7 @@ let method_signature_of_decl meth_decl block_data_opt =
ms, fdi.Clang_ast_t.fdi_body, extra_instrs
| CXXMethodDecl (decl_info, name_info, tp, fdi, mdi), _
| CXXConstructorDecl (decl_info, name_info, tp, fdi, mdi), _ ->
let method_name = IList.hd name_info.Clang_ast_t.ni_qual_name in
let method_name = Ast_utils.get_unqualified_name name_info in
let class_name = Ast_utils.get_class_name_from_member name_info in
let procname = General_utils.mk_procname_from_cpp_method class_name method_name tp in
let method_decl = Cpp_Meth_decl_info (fdi, mdi, class_name, tp) in

@ -397,7 +397,7 @@ struct
let open CContext in
let context = trans_state.context in
let name_info, decl_ptr, type_ptr = get_info_from_decl_ref decl_ref in
let method_name = name_info.Clang_ast_t.ni_name in
let method_name = Ast_utils.get_unqualified_name name_info in
let class_name = Ast_utils.get_class_name_from_member name_info in
Printing.log_out "!!!!! Dealing with method '%s' @." method_name;
let method_typ = CTypes_decl.type_ptr_to_sil_type context.tenv type_ptr in

Loading…
Cancel
Save