[Prev][Next][Index]

Re: SgForStmt->setbody() and SgStatement->insertAfterStmt()



>If the assumptions stated above are not true (which, by implication,  
> I will take to mean as 'lexNext() does not mean what I think it 

> means') ...

I think they are, in general, true. But clearly. they are not  
_always_ true, since Darryl's code seg faults. One, in my opinion,  
simple way to avoid those seg faults would be to add "if" statements  
in appropriate places in the call graph code. For example,  instead  
of assuming that each non-GLOBAL node has a control parent and, say,  
writing:
s->controlParent()->variant(), 

you could write
if(ss=s->controlParent()) ss->variant()

If you wish, you could add an "else" to that "if" and print out a  
message that would specify which of your assumption has just been  
violated and where (something like "statement such-and-such does not  
have a control parent"). As long as you do not call "exit" inside  
this "else", a program that uses the call graph module would still be  
able to go on without seg faulting. Moreover, maybe the messages  
would help us identify which of your assumptions are violated and  
where in a more efficient way than the present approach.
                            --Beata