plast-lab / cclyzer

A tool for analyzing LLVM bitcode using Datalog.
MIT License
96 stars 14 forks source link

Handle super-classes of zero size w.r.t. field name generation #3

Closed gbalats closed 8 years ago

gbalats commented 8 years ago

Right now, whenever a class inherits from at least two other classes and one of them has zero size (e.g., a facade class, or the base case of a variadic data structure such as a tuple), the fact-import step fails with a functional dependency violation.

The reason is that these two superclasses would both be mapped to zero bit offset for their corresponding fields in pred::struct_type::field_name.

We must somehow detect such zero-size supertypes and produce the correct mapping either at the front-end (during dwarf debug info parsing), or at the Datalog level by comparing with the known types of the Type entity at bit offset 0.

gbalats commented 8 years ago

Also relevant of course is the Empty Base Optimization.

Allows the size of an empty base subobject to be zero. ... However, base class subobjects are not so constrained, and can be completely optimized out from the object layout