This patch teaches CFLAnders to perform field offset arithmetic when propagating reachability along assignment edges.The only tricky part here is to get the plus/minus signs of those offsets right. Other than that, the analysis logic doesn't need to change too much.
Vurrent implementation should suffice for intra-procedural field-sensitive analysis. Unfortunately if we move to inter-procedural case, the correctness of the analysis is lost. The reason is that our current interprocedural analysis framework can only record ExternalRelations of the form "X = Y + Offset", where X and Y are InterfaceValues. Field-sensitive inter-procedural function summary often encounters relations of the form "*X = *(Y + Offset)", and there is no way to describe such a relation in the function summary without introducing any temporaries. In fact, even if the function summary knows how to describe those relations, for CFLGraph we have the same problem.
This is not a fundamentally hard problem to solve, but it is annoying in the sense that it's hard to get around it with just simple hacks. I am still figuring out a way to solve the aforementioned problem with as little modification to the current codebase as possible. My intuition is that no matter what I do, the change is not going to be small. So I'll just check in the intraprocedural analysis works to ease the burden of code review.
If we get many more of these, it may be nice to just have a cflaa::PointerOffset type (or whatever) with operators that know how to handle checking for unknown. If only because it would make it more difficult to cause subtle bugs.