[procname] Change type Procname.c to store record instead of tuple

Summary: That tuple has 3 elements already, there may be 4th element coming.

Reviewed By: mbouaziz

Differential Revision: D4721342

fbshipit-source-id: cba44ef
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot
parent 0b4f4953a5
commit 9d64ea23ff

@ -319,7 +319,8 @@ let module Procname = {
[@@deriving compare];
/** Type of c procedure names. */
type c = (string, option string, template_spec_info) [@@deriving compare];
type c = {name: string, mangled: option string, template_args: template_spec_info}
[@@deriving compare];
type objc_cpp_method_kind =
| CPPMethod (option string) /** with mangling */
| CPPConstructor (option string, bool) /** with mangling + is it constexpr? */
@ -403,12 +404,12 @@ let module Procname = {
| None => (None, package_classname)
};
let split_typename typename => split_classname (Typename.name typename);
let from_string_c_fun (s: string) => C (s, None, NoTemplate);
let c (plain: string) (mangled: string) (template_args: template_spec_info) => (
plain,
Some mangled,
let c (name: string) (mangled: string) (template_args: template_spec_info) => {
name,
mangled: Some mangled,
template_args
);
};
let from_string_c_fun (name: string) => C {name, mangled: None, template_args: NoTemplate};
let java class_name return_type method_name parameters kind => {
class_name,
return_type,
@ -487,7 +488,7 @@ let module Procname = {
let get_method =
fun
| ObjC_Cpp name => name.method_name
| C (name, _, _) => name
| C {name} => name
| Block name => name
| Java j => j.method_name
| Linters_dummy_method => "Linters_dummy_method";
@ -690,7 +691,7 @@ let module Procname = {
};
let get_global_name_of_initializer =
fun
| C (name, _, _) when String.is_prefix prefix::Config.clang_initializer_prefix name => {
| C {name} when String.is_prefix prefix::Config.clang_initializer_prefix name => {
let prefix_len = String.length Config.clang_initializer_prefix;
Some (String.sub name pos::prefix_len len::(String.length name - prefix_len))
}
@ -744,7 +745,7 @@ let module Procname = {
let to_unique_id pn =>
switch pn {
| Java j => java_to_string j Verbose
| C (c1, c2, _) => to_readable_string (c1, c2) true
| C {name, mangled} => to_readable_string (name, mangled) true
| ObjC_Cpp osig => c_method_to_string osig Verbose
| Block name => name
| Linters_dummy_method => "Linters_dummy_method"
@ -754,7 +755,7 @@ let module Procname = {
let to_string p =>
switch p {
| Java j => java_to_string j Non_verbose
| C (c1, c2, _) => to_readable_string (c1, c2) false
| C {name, mangled} => to_readable_string (name, mangled) false
| ObjC_Cpp osig => c_method_to_string osig Non_verbose
| Block name => name
| Linters_dummy_method => to_unique_id p
@ -764,7 +765,7 @@ let module Procname = {
let to_simplified_string withclass::withclass=false p =>
switch p {
| Java j => java_to_string withclass::withclass j Simple
| C (c1, c2, _) => to_readable_string (c1, c2) false ^ "()"
| C {name, mangled} => to_readable_string (name, mangled) false ^ "()"
| ObjC_Cpp osig => c_method_to_string osig Simple
| Block _ => "block"
| Linters_dummy_method => to_unique_id p
@ -793,7 +794,7 @@ let module Procname = {
let pp_set fmt set => Set.iter (fun pname => F.fprintf fmt "%a " pp pname) set;
let get_qualifiers pname =>
switch pname {
| C c => fst3 c |> QualifiedCppName.qualifiers_of_qual_name
| C {name} => QualifiedCppName.qualifiers_of_qual_name name
| ObjC_Cpp objc_cpp =>
List.append
(QualifiedCppName.qualifiers_of_qual_name (Typename.name objc_cpp.class_name))
@ -807,7 +808,8 @@ let module Procname = {
let get_qual_name_str pname => get_qualifiers pname |> List.rev |> String.concat sep::"#";
let proc_id =
switch pname {
| C (_, c2, _) => [get_qual_name_str pname, ...Option.to_list c2] |> String.concat sep::"#"
| C {mangled} =>
[get_qual_name_str pname, ...Option.to_list mangled] |> String.concat sep::"#"
| ObjC_Cpp objc_cpp =>
get_qual_name_str pname ^ "#" ^ c_method_kind_verbose_str objc_cpp.kind
| _ => to_unique_id pname

Loading…
Cancel
Save