<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>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>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></body></html>