Summary: The Quandary-style traces are too general for checkers like SIOF. This diff adds a "suffix abstraction" of the trace for analyses that just care about sinks. To show how to use it, we add it to SIOF. Note: this diff converts the domain, but isn't actually doing the fancier reporting yet. That will come in a future diff. Reviewed By: jvillard Differential Revision: D4117393 fbshipit-source-id: e473665master
							parent
							
								
									31093801d4
								
							
						
					
					
						commit
						ea26d6f179
					
				@ -0,0 +1,25 @@
 | 
				
			||||
(*
 | 
				
			||||
 * Copyright (c) 2016 - present Facebook, Inc.
 | 
				
			||||
 * All rights reserved.
 | 
				
			||||
 *
 | 
				
			||||
 * This source code is licensed under the BSD style license found in the
 | 
				
			||||
 * LICENSE file in the root directory of this source tree. An additional grant
 | 
				
			||||
 * of patent rights can be found in the PATENTS file in the same directory.
 | 
				
			||||
 *)
 | 
				
			||||
 | 
				
			||||
open! Utils
 | 
				
			||||
 | 
				
			||||
module F = Format
 | 
				
			||||
module L = Logging
 | 
				
			||||
 | 
				
			||||
module Make (Spec : TraceElem.S) = struct
 | 
				
			||||
  include Trace.Make(struct
 | 
				
			||||
      module Source = Source.Dummy
 | 
				
			||||
      module Sink = struct
 | 
				
			||||
        include Spec
 | 
				
			||||
        let get _ _ = []
 | 
				
			||||
      end
 | 
				
			||||
 | 
				
			||||
      let should_report _ _ = true
 | 
				
			||||
    end)
 | 
				
			||||
end
 | 
				
			||||
@ -0,0 +1,13 @@
 | 
				
			||||
(*
 | 
				
			||||
 * Copyright (c) 2016 - present Facebook, Inc.
 | 
				
			||||
 * All rights reserved.
 | 
				
			||||
 *
 | 
				
			||||
 * This source code is licensed under the BSD style license found in the
 | 
				
			||||
 * LICENSE file in the root directory of this source tree. An additional grant
 | 
				
			||||
 * of patent rights can be found in the PATENTS file in the same directory.
 | 
				
			||||
 *)
 | 
				
			||||
 | 
				
			||||
module Make (Spec : TraceElem.S) :
 | 
				
			||||
  Trace.S with module Source = Source.Dummy
 | 
				
			||||
           and module Sink.Kind = Spec.Kind
 | 
				
			||||
           and type Sink.t = Spec.t
 | 
				
			||||
@ -0,0 +1,50 @@
 | 
				
			||||
(*
 | 
				
			||||
 * Copyright (c) 2016 - present Facebook, Inc.
 | 
				
			||||
 * All rights reserved.
 | 
				
			||||
 *
 | 
				
			||||
 * This source code is licensed under the BSD style license found in the
 | 
				
			||||
 * LICENSE file in the root directory of this source tree. An additional grant
 | 
				
			||||
 * of patent rights can be found in the PATENTS file in the same directory.
 | 
				
			||||
 *)
 | 
				
			||||
 | 
				
			||||
open! Utils
 | 
				
			||||
 | 
				
			||||
module F = Format
 | 
				
			||||
module L = Logging
 | 
				
			||||
 | 
				
			||||
module Globals = struct
 | 
				
			||||
  type t = Pvar.t
 | 
				
			||||
  let compare = Pvar.compare
 | 
				
			||||
  let pp fmt pvar = (Pvar.pp pe_text) fmt pvar
 | 
				
			||||
end
 | 
				
			||||
 | 
				
			||||
include SinkTrace.Make(struct
 | 
				
			||||
    module Kind = Globals
 | 
				
			||||
 | 
				
			||||
    type t = {
 | 
				
			||||
      site : CallSite.t;
 | 
				
			||||
      kind: Kind.t;
 | 
				
			||||
    }
 | 
				
			||||
 | 
				
			||||
    let call_site { site; } = site
 | 
				
			||||
 | 
				
			||||
    let kind { kind; } = kind
 | 
				
			||||
 | 
				
			||||
    let make kind site = { kind; site; }
 | 
				
			||||
 | 
				
			||||
    let to_callee t site = { t with site; }
 | 
				
			||||
 | 
				
			||||
    let compare t1 t2 =
 | 
				
			||||
      CallSite.compare t1.site t2.site
 | 
				
			||||
      |> next Kind.compare t1.kind t2.kind
 | 
				
			||||
 | 
				
			||||
    let pp fmt { site; kind; } =
 | 
				
			||||
      F.fprintf fmt "Access to %a at %a" Kind.pp kind CallSite.pp site
 | 
				
			||||
 | 
				
			||||
    module Set = PrettyPrintable.MakePPSet (struct
 | 
				
			||||
        type nonrec t = t
 | 
				
			||||
        let compare = compare
 | 
				
			||||
        let pp_element = pp
 | 
				
			||||
      end)
 | 
				
			||||
 | 
				
			||||
  end)
 | 
				
			||||
@ -0,0 +1,19 @@
 | 
				
			||||
(*
 | 
				
			||||
 * Copyright (c) 2016 - present Facebook, Inc.
 | 
				
			||||
 * All rights reserved.
 | 
				
			||||
 *
 | 
				
			||||
 * This source code is licensed under the BSD style license found in the
 | 
				
			||||
 * LICENSE file in the root directory of this source tree. An additional grant
 | 
				
			||||
 * of patent rights can be found in the PATENTS file in the same directory.
 | 
				
			||||
 *)
 | 
				
			||||
 | 
				
			||||
open! Utils
 | 
				
			||||
 | 
				
			||||
module Globals :
 | 
				
			||||
sig
 | 
				
			||||
  type t = Pvar.t
 | 
				
			||||
  val compare : t -> t -> int
 | 
				
			||||
  val pp : Format.formatter -> t -> unit
 | 
				
			||||
end
 | 
				
			||||
 | 
				
			||||
include Trace.S with module Sink.Kind = Globals
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue