This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] introduce getSVal(Stmt *) helper on ExplodedNode, make sure the helper is used consistently
ClosedPublic

Authored by george.karpenkov on Jan 16 2018, 5:54 PM.

Details

Summary

In many cases

N->getState()->getSVal(E, N->getLocationContext())

is ugly, verbose, and also opens up more surface area for bugs if an inconsistent location context is used.

This patch introduces a helper on an exploded node, and ensures consistent usage of either ExplodedNode::getSVal or CheckContext::getSVal across the codebase.
As a result, a large number of redundant lines is removed.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ added a comment.Jan 17 2018, 9:43 AM

Looks pretty much awesome!

opens up more surface area for bugs if an inconsistent location context is used

Dunno, i just hope that in all these places the default location context is the correct one.

lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
1020

State seems unused anymore.

NoQ accepted this revision.Jan 17 2018, 9:43 AM
This revision is now accepted and ready to land.Jan 17 2018, 9:43 AM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.