<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 24, 2010, at 12:23 AM, Marcin Ĺwiderski wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div class="gmail_quote"><div><br class="Apple-interchange-newline">Implicit call to C++ destructor is part of control flow of a program and it should have representation in CFG. However variable going out of scope is not IMO, so I don't think that this would be a good idea. And for C we can jump over variable initialization. So should we create destructor node for 'p' in this case also?:</div><div><br></div><div>void f() {</div><div> goto label;</div><div> {</div><div> int* p = malloc(4);</div><div>label:</div><div> ...</div><div> }</div><div> ...</div><div>}</div><div><br></div></div></span></blockquote><div><br></div><div>This is an excellent example. I don't think we need a destructor CFGElement for 'p'.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">As I understand for delimiter approach we need StartScope and EndScope delimiters to know where in CFG we enter and leave scopes but without jump. In case of jumps it would be for client to deduce what scopes will be left and entered? I mean we don't need any more information in CFG for this?</span></blockquote><div><br></div><div>Scopes are created in well-specified places. It should be trivial to define a ScopeMap data structure that maps from Stmt* -> scope. This could be used by GRExprEngine when creating memory regions with a LocationContext that captures the current scope chain. When we see an access to a region, we can also tell if that region is still valid by consulting the currently active scope chain. This can all be done lazily. I see no reason why this needs to be in the CFG.</div><div><br></div><div>Destructors, on the other hand, need to be in the CFG because they are sequenced events that take place at specific points in the code.</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><font class="Apple-style-span" color="#000000"><br></font></div><div>If that is the case I understand that that what is to be done is:</div><div>- Adding implicit scopes for selection and iteration statements in case the body is not a compound statement but declares some variables,</div><div>- Not adding EndScope delimiter if scope ends with jump as it would produce unnecessary unreachable CFGBlock.</div></span></blockquote><div><br></div><div>I think doing this is all overkill, and without a clear benefit over just querying scope information on the side I'm really resistant to seeing this go into the CFG.</div></div><br><div><br></div></body></html>