[cfe-dev] SymbolRef and SVal confusion

Richard tarka.t.otter at googlemail.com
Wed Dec 19 08:45:31 PST 2012


hey

I am having a bit of a hard time understanding the connection between SVals and SymbolRefs, could someone enlighten me? As I understand it, SVals are transient, and SymbolRefs are not, which makes them handy for tracking state. However, some SVals don't have SymbolRefs. What is the recommended way of identifying an SVal with no SymbolRef at a later stage in a checker execution? All the examples I have looked at just bail when there is no SymbolRef.

I find that the following code has a SymbolRef for the SVal in the branch condition:

int main(int argc, char *argv[])
{
    UILabel *l = [[UILabel alloc] init];
    
    BOOL available = [l respondsToSelector:@selector(adjustsLetterSpacingToFitWidth)];    
    if (available)
        l.adjustsLetterSpacingToFitWidth = YES;
    
    [l release];
    
	return 0;
}

But the following code does not:

int main(int argc, char *argv[])
{
    UILabel *l = [[UILabel alloc] init];
    
    BOOL available = [l respondsToSelector:@selector(adjustsLetterSpacingToFitWidth)];
    BOOL unavailable = !available;
    
    if (available)
        l.adjustsLetterSpacingToFitWidth = YES;
    
    [l release];
    
	return 0;
}

Any condition that is a binary or unary operator seems to have an SVal with no SymbolRef. I would love to know why.

thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121219/61ba4d1f/attachment.html>


More information about the cfe-dev mailing list