<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>hey</div><div><br></div><div>i had not seen your talk, very informative. i am trying to write a checker to warn when methods are being used that became available later than the minimum deployment target. i am using the checkPreCall callback to look for C or ObjC calls that have availability information. if this is greater than the deployment target i then walk back up the ParentMap looking for an enclosing IfStmt that has a condition that is a respondsToSelector: call or a != NULL for a method with a suitable availability attribute, if one is not found then emit a warning.</div><div><br></div><div>but from your talk i gather that this is probably not a good way to do it. perhaps i should implement the checkBranchCondition callback and look for the correct condition and save the SVal for later. then in checkPreCall i need to get the SVal for the condition and use the ConstraintManager to work out if i am on the true branch, something like that? does this make sense? or do you have a better suggestion?</div><div><br></div><div>ta</div><br><div><div>On 12 Dec 2012, at 18:30, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Well, if you're already using ParentMap, you could see if the Stmt just below the IfStmt represents the "then" statement or the "else" statement. (Or neither, if it's the condition!) However, if you've <a href="http://llvm.org/devmtg/2012-11/">seen our talk</a>, you'll remember that pattern-matching against statement kinds isn't the best way to determine control flow or assumptions:</div><div><br></div><div>- The user could have used "while" or "?:" instead of "if".</div><div>- There could be a goto or longjmp involved.</div><div>- You may be within an inlined function which is itself within an "if".</div><div>- Someone may have used an early return (or break or continue) instead of putting the rest of the block in an else-clause.</div><div><br></div><div>So, what are you actually trying to achieve?</div><div>Jordan</div><div><br></div><br><div><div>On Dec 12, 2012, at 8:06 , Richard <<a href="mailto:tarka.t.otter@googlemail.com">tarka.t.otter@googlemail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">hey there<br><br>i am writing a static analyzer checker that needs to know if it is contained in a surrounding IfStmt, and if the current node is on the true or false branch. what is the simplest way to achieve this? <br><br>currently i am using the previous nodes ParentMap and walking back up through parents until i find an IfStmt, but i am unsure how i can tell if this node belongs to the If or an Else / Else If branch. any pointers?<br><br>ta<br><br><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></blockquote></div><br></div></blockquote></div><br></body></html>