[clang] Upgrade Infer after change to the plugin to swap storage_class with is_static

Summary:
We currently use storage_class only for checking is_static, adding the flag instead in the plugin to improve perf by avoiding string comparisons.

update-submodule: facebook-clang-plugins

Reviewed By: ngorogiannis

Differential Revision: D17156173

fbshipit-source-id: 2b84a0b84
master
Dulma Churchill 5 years ago committed by Facebook Github Bot
parent 1046c63b0f
commit 0904be07aa

@ -1 +1 @@
Subproject commit 80f1227070a8e284ad05664bd3d9b959f0b63573
Subproject commit eeff8d14a8d98d5c157ebaf84cb320866ffaf1f0

@ -542,23 +542,21 @@ and get_template_info tenv (fdi : Clang_ast_t.function_decl_info) =
and mk_c_function ?tenv name function_decl_info_opt parameters =
let file =
match function_decl_info_opt with
| Some (decl_info, function_decl_info) -> (
match function_decl_info.Clang_ast_t.fdi_storage_class with
| Some "static"
(* when we model static functions, we cannot take the file into account to
create a mangled name because the file of the model is different to the real file,
thus the model won't work *)
when not (CTrans_models.is_modelled_static_function (QualifiedCppName.to_qual_string name))
->
let file_opt =
(fst decl_info.Clang_ast_t.di_source_range).Clang_ast_t.sl_file
|> Option.map ~f:SourceFile.from_abs_path
in
let file_to_hex src = SourceFile.to_string src |> Utils.string_crc_hex32 in
Option.value_map ~f:file_to_hex ~default:"" file_opt
| _ ->
"" )
| None ->
(* when we model static functions, we cannot take the file into account to
create a mangled name because the file of the model is different to the real file,
thus the model won't work *)
| Some (decl_info, function_decl_info)
when function_decl_info.Clang_ast_t.fdi_is_static
&& not
(CTrans_models.is_modelled_static_function (QualifiedCppName.to_qual_string name))
->
let file_opt =
(fst decl_info.Clang_ast_t.di_source_range).Clang_ast_t.sl_file
|> Option.map ~f:SourceFile.from_abs_path
in
let file_to_hex src = SourceFile.to_string src |> Utils.string_crc_hex32 in
Option.value_map ~f:file_to_hex ~default:"" file_opt
| _ ->
""
in
let mangled_opt, is_cpp =

@ -141,7 +141,7 @@ let mk_sil_global_var {CFrontend_config.source_file} ?(mk_name = fun _ x -> x) d
var_decl_info.Clang_ast_t.vdi_is_global
(* only top level declarations are really have file scope, static field members have a global scope *)
&& (not var_decl_info.Clang_ast_t.vdi_is_static_data_member)
&& match var_decl_info.Clang_ast_t.vdi_storage_class with Some "static" -> true | _ -> false
&& var_decl_info.Clang_ast_t.vdi_is_static
in
Pvar.mk_global ~is_constexpr ~is_ice ~is_pod
~is_static_local:var_decl_info.Clang_ast_t.vdi_is_static_local ~is_static_global

Loading…
Cancel
Save