This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Support modelling no-op BaseToDerived casts in ExprEngine
ClosedPublic

Authored by NoQ on Aug 23 2018, 3:30 PM.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ commandeered this revision.Aug 24 2018, 5:32 PM
NoQ edited reviewers, added: george.karpenkov; removed: NoQ.
NoQ updated this revision to Diff 162518.Aug 24 2018, 5:36 PM

Tried to address the regression with double inheritance by introducing a CXXDerivedObjectRegion, which is the opposite of CXXBaseObjectRegion, to represent such casts. Such region is a bit weird because it is by design bigger than its super-region. But it's not harmful when it is put on top of a SymbolicRegion that has unknown extent anyway.

Offset computation for CXXDerivedObjectRegion and proper modeling of casts still remains to be implemented. It seems to be useful to keep the base class decl as part of the region's identity, but i didn't do that yet.

In any case, it addresses the regression that i was thinking of: otherwise, in the base_to_derived_double_inheritance test it'd think that x, rather than y, was set.

george.karpenkov accepted this revision.Aug 24 2018, 5:37 PM
This revision is now accepted and ready to land.Aug 24 2018, 5:37 PM
This revision was automatically updated to reflect the committed changes.