[cfg] store the same version of the attributes as the attributes table

Summary:
Before storing attributes to disk, we fix their location information if needed.
Ideally we wouldn't be creating bogus attributes but sometimes the frontends
are built in a way that makes it difficult to do otherwise, thus we have to
live with this. However, what's aggravating is that attributes are also saved
in the proc descs of these procedures but in their wrong version. This makes
the two versions (inside the procedures sqlite table and inside the procdesc in
the cfg of the source_files table) agree.

Reviewed By: jeremydubreil

Differential Revision: D10084708

fbshipit-source-id: 5bfd5da3a
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 9c09ce4ba3
commit cd49a0c72d

@ -75,7 +75,8 @@ let save_attributes source_file cfg =
let loc' = if Location.equal loc Location.dummy then {loc with file= source_file} else loc in
{attributes with loc= loc'; translation_unit= source_file}
in
Attributes.store attributes'
Attributes.store attributes' ;
Procdesc.set_attributes pdesc attributes'
in
Typ.Procname.Hash.iter save_proc cfg

@ -393,7 +393,7 @@ module IdMap = Node.IdMap
(** procedure description *)
type t =
{ attributes: ProcAttributes.t (** attributes of the procedure *)
{ mutable attributes: ProcAttributes.t (** attributes of the procedure *)
; mutable nodes: Node.t list (** list of nodes of this procedure *)
; mutable nodes_num: int (** number of nodes *)
; mutable start_node: Node.t (** start node of this procedure *)
@ -433,6 +433,8 @@ let signal_did_preanalysis pdesc = (pdesc.attributes).did_preanalysis <- true
let get_attributes pdesc = pdesc.attributes
let set_attributes pdesc attributes = pdesc.attributes <- attributes
let get_exit_node pdesc = pdesc.exit_node
(** Return name and type of formal parameters *)

@ -202,6 +202,8 @@ val get_access : t -> PredSymb.access
val get_attributes : t -> ProcAttributes.t
(** Get the attributes of the procedure. *)
val set_attributes : t -> ProcAttributes.t -> unit
val get_captured : t -> (Mangled.t * Typ.t) list
(** Return name and type of block's captured variables *)

Loading…
Cancel
Save