Skip to content

Commit

Permalink
fixes arguments attributes in the callsites plugin (#1034)
Browse files Browse the repository at this point in the history
* fixes arguments attributes in the callsites plugin

When attributes are assigned to a newly created synthetic argument term
in the callsites plugin, we don't take into consideration attributes
from the original argument term. This PR fixes this and now all the
attributes from origin argument term are assigned to the new one.

* a couple cosmetic changes
  • Loading branch information
gitoleg authored Feb 6, 2020
1 parent 6efba4d commit 948165b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/bap_c/bap_c_attr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ module Gnu = struct
register_attr "malloc" (set Sub.malloc);
register_attr "noreturn" (set Sub.noreturn);
register_attr "returns_twice" (set Sub.returns_twice);
register_attr "noreturn" (set Sub.nothrow)
register_attr "nothrow" (set Sub.nothrow)
end
5 changes: 2 additions & 3 deletions plugins/callsites/callsites_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ let callee call prog = match Call.target call with
let require x = Option.some_if x ()

let def_of_arg arg =
let x = Arg.lhs arg in
let e = Arg.rhs arg in
Some (Def.create x e)
let d = Def.create (Arg.lhs arg) (Arg.rhs arg) in
Some (Term.with_attrs d (Term.attrs arg))

let intent_matches x y = match Arg.intent x with
| None -> true
Expand Down

0 comments on commit 948165b

Please sign in to comment.