This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Admit that we can't simplify the newly produced mixed Loc/NonLoc expressions.
ClosedPublic

Authored by NoQ on Jul 24 2018, 12:13 PM.

Details

Summary

Add one more defensive check to prevent crashes on trying to simplify a SymSymExpr with different Loc-ness of operands. This fix is similar to D49703 and addresses a regression caused by D48650.

When an operation between a nonloc::LocAsInteger and a non-pointer symbol is performed, the LocAsInteger-specific part of information is lost. When the non-pointer symbol is collapsing into a constant, we cannot easily re-evaluate the result, because we need to recover the missing LocAsInteger-specific information (eg., integer type, or the very fact that this pointer was at some point converted to an integer).

Diff Detail

Event Timeline

NoQ created this revision.Jul 24 2018, 12:13 PM
NoQ edited the summary of this revision. (Show Details)Jul 24 2018, 12:52 PM
george.karpenkov requested changes to this revision.Jul 24 2018, 1:02 PM
george.karpenkov added inline comments.
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
1300

could we eliminate the code duplication with lines 1308-1310?

This revision now requires changes to proceed.Jul 24 2018, 1:02 PM

It fixes Xerces verification. Thanks.

NoQ requested review of this revision.Jul 25 2018, 4:14 PM
NoQ marked an inline comment as done.
NoQ added inline comments.
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
1300

Moved to D49826 because it's much larger than this patch.

george.karpenkov accepted this revision.Jul 27 2018, 4:12 PM
This revision is now accepted and ready to land.Jul 27 2018, 4:12 PM
NoQ closed this revision.EditedJul 31 2018, 12:28 PM
NoQ marked an inline comment as done.

Committed in rC338425 but i accidentally screwed the revision link.