Skip to content

Commit

Permalink
Add TODOs about AddressDomain queries usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Sep 11, 2023
1 parent 5938225 commit c8cc6c4
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/analyses/condVars.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct
) else ad
in
List.filter_map (function
| ValueDomain.Addr.Addr (v,o) -> Some (v, ValueDomain.Addr.Offs.to_exp o)
| ValueDomain.Addr.Addr (v,o) -> Some (v, ValueDomain.Addr.Offs.to_exp o) (* TODO: use unconverted addrs in domain? *)
| _ -> None
) (Queries.AD.elements a')
| _ -> []
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/malloc_null.ml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct
| ad when not (Queries.AD.is_top ad) ->
let to_extra addr ads =
match addr with
| Queries.AD.Addr.Addr mval -> AD.of_mval mval :: ads
| Queries.AD.Addr.Addr mval -> AD.of_mval mval :: ads (* TODO: why list of singleton AD-s? *)
| _ -> ads
in
Queries.AD.fold to_extra ad []
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/memLeak.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct
| Queries.AD.Addr.Addr (v,_) when ctx.ask (Queries.IsHeapVar v) && not @@ ctx.ask (Queries.IsMultiple v) -> D.singleton v
| _ -> D.empty ()
in
D.diff state unique_pointed_to_heap_vars
D.diff state unique_pointed_to_heap_vars (* TODO: use D.remove instead of diffing singleton *)
| _ -> state
end
| Abort ->
Expand Down
4 changes: 2 additions & 2 deletions src/analyses/mutexTypeAnalysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct
module O = Offset.Unit

module V = struct
include Printable.Prod(CilType.Varinfo)(O)
include Printable.Prod(CilType.Varinfo)(O) (* TODO: use Mval.Unit *)
let is_write_only _ = false
end

Expand Down Expand Up @@ -56,7 +56,7 @@ struct
let attr = ctx.ask (Queries.EvalMutexAttr attr) in
let mutexes = ctx.ask (Queries.MayPointTo mutex) in
(* It is correct to iter over these sets here, as mutexes need to be intialized before being used, and an analysis that detects usage before initialization is a different analysis. *)
Queries.AD.iter (function addr ->
Queries.AD.iter (function addr ->
match addr with
| Queries.AD.Addr.Addr (v,o) -> ctx.sideg (v,O.of_offs o) attr
| _ -> ()
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/poisonVariables.ml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct
| ad ->
Queries.AD.fold (fun addr vs ->
match addr with
| Queries.AD.Addr.Addr (v,o) -> rem_mval vs (v, ValueDomain.Offs.to_exp o)
| Queries.AD.Addr.Addr (v,o) -> rem_mval vs (v, ValueDomain.Offs.to_exp o) (* TODO: use unconverted addrs in domain? *)
| _ -> vs
) ad ctx.local
end
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/taintPartialContexts.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let to_mvals ad =
(* TODO: should one handle ad with unknown pointers separately like in (all) other analyses? *)
Queries.AD.fold (fun addr mvals ->
match addr with
| Queries.AD.Addr.Addr (v,o) -> D.add (v, ValueDomain.Offs.to_exp o) mvals
| Queries.AD.Addr.Addr (v,o) -> D.add (v, ValueDomain.Offs.to_exp o) mvals (* TODO: use unconverted addrs in domain? *)
| _ -> mvals
) ad (D.empty ())

Expand Down
2 changes: 1 addition & 1 deletion src/analyses/uninit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ struct
| ad when not (Queries.AD.is_top ad) ->
let to_extra ad ads =
match ad with
| Queries.AD.Addr.Addr mval -> AD.of_mval mval :: ads
| Queries.AD.Addr.Addr mval -> AD.of_mval mval :: ads (* TODO: why list of singleton AD-s? *)
| _ -> ads
in
Queries.AD.fold to_extra ad []
Expand Down
4 changes: 2 additions & 2 deletions src/analyses/varEq.ml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct
if Queries.AD.is_top aad
then false
else Queries.AD.exists (function
| Addr (u,s) -> CilType.Varinfo.equal v u && oleq o (Addr.Offs.to_exp s)
| Addr (u,s) -> CilType.Varinfo.equal v u && oleq o (Addr.Offs.to_exp s) (* TODO: avoid conversion? *)
| _ -> false
) aad
in
Expand Down Expand Up @@ -298,7 +298,7 @@ struct
else if Queries.AD.is_top bad
then ((*Messages.warn ~category:Analyzer "No PT-set: switching to types ";*) type_may_change_apt a )
else Queries.AD.exists (function
| Addr (v,o) -> lval_may_change_pt a (v, Addr.Offs.to_exp o)
| Addr (v,o) -> lval_may_change_pt a (v, Addr.Offs.to_exp o) (* TODO: avoid conversion? *)
| _ -> false
) bad
in
Expand Down

0 comments on commit c8cc6c4

Please sign in to comment.