This is a patch that adds a new flag considerVariableAddrOfAsDef to the
Use-Def Analysis. It is similar to considerVariableAddrOfAsUse. If
enabled, taking the address of a variable will be considered as a
definition of that variable.
--- src/ext/usedef.ml 2009-04-24 13:50:33.000000000 -0500
+++ src/ext/usedef.ml 2010-10-04 12:12:08.000000000 -0500
@@ -33,6 +33,10 @@
let considerVariableAddrOfAsUse: (varinfo -> bool) ref =
ref (fun _ -> true)
+(** Say if you want to consider a variable addrof as a def *)
+let considerVariableAddrOfAsDef: (varinfo -> bool) ref =
+ ref (fun _ -> false)
+
(** Return any vars that should be considered "used" by an expression,
other than the ones it refers to directly. Deputy uses this for
variables in Cast annotations. *)
@@ -106,6 +110,8 @@
ignore (visitCilOffset (self :> cilVisitor) off);
if (!considerVariableAddrOfAsUse) v then
varUsed := VS.add v !varUsed;
+ if (!considerVariableAddrOfAsDef) v then
+ varDefs := VS.add v !varDefs;
SkipChildren
| SizeOfE _
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users