[cfe-dev] fix for Clang PR 8419

Zhanyong Wan (λx.x x) wan at google.com
Thu Nov 4 17:28:37 PDT 2010


Hi Ted,

I'm working on fixing PR8419, and would like to check with you if I'm
on the right track.

As I found out, the analyzer crashes on

  ++s[0];

as it expects s[0] to be a Loc (which it should be), but instead sees a NonLoc.

Upon reading the analyzer code, I see two things that don't seem right:

1. EnvironmentManager::bindExprAndLocation() throws away the
'location' argument.

2. GRExprEngine.cpp calls state->getSVal(Ex) to get the location of
Ex, but the implementation of getSVal(Ex) doesn't use the right key
(should be something like MakeLocation(Ex) to look up the expression.

Please see http://codereview.appspot.com/2920041/ for a very early
draft.  It's not yet cleaned up and some changes aren't strictly
necessary -- I'll clean up after the discussion.

I'm sure it's not quite right, as I'm still figuring out how the
analyzer works.  (I wish there are more comments in the code. ;)

Could you let me know if the direction of the patch is correct?  What
problems do you see in it?

Also, what do you think is the best way to ramp up on the analyzer code base?

Thanks,
-- 
Zhanyong



More information about the cfe-dev mailing list