On Thu, Apr 8, 2010 at 9:18 AM, ThanhVu (Vu) Nguyen <nguyenthanh...@gmail.com> wrote: >> >> >> It depends on the semantics you expect, but my rule of thumb is: >> >> 1) NEVER use ChangeTo (or its ChangeDoChildrenPost counterpart) in >> vstmt (unless you return the same statement of course). >> 2) If you really feel the need to use it, think twice and goto rule 1. > > > If I need to instrument my code (e.g., inserting something to existing > code), then I have to use one of these ChangeTo or ChangeDoChildrenPost > right ? Just want to make sure that I use CIL correctly.
Returning a new statement in vstmt is, like Gabriel said, essentially *always* a bad idea (more specifically, removing any statement with a label on it just leads to broken code). In all the cases I've run into, changing the stmt's skind field was the right solution (like Gabriel, I learned this the hard way ;-)). David Gay ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ CIL-users mailing list CIL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cil-users