This is an archive of the discontinued LLVM Phabricator instance.

Add the way to extract SVals of arguments used in a call for a given StackFrameCtx
AbandonedPublic

Authored by NoQ on Nov 16 2016, 12:06 PM.

Details

Summary

This patch adds getArgsSVal method to ProgramState that allows the user to obtain SVals of argumetns used in a call that created the given StackFrameCtx. I know this isn't perfect (Alexey Sidorin pointed out that there is a problem with line 741 - argument values may be overwritten) but wanted to submit it separate from other changes that I do and find _the_ right solution.

Diff Detail

Event Timeline

k-wisniewski retitled this revision from to Add the way to extract SVals of arguments used in a call for a given StackFrameCtx.
k-wisniewski updated this object.
k-wisniewski added a subscriber: cfe-commits.
NoQ edited edge metadata.Nov 16 2016, 12:43 PM

I'm ok with constructing SymbolRegionValue for ArgLoc manually and adding a comment like FIXME: leaking implementation details of RegionStoreManager.

NoQ added a comment.Nov 18 2016, 5:30 PM

Note that the uncontrolled recursion checker will not be able to test this overwrite problem, because overwriting the argument region spoils the stack frame for it.

include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
743

Hmm, this should work:

~ 743     StoreManager &storeMgr = stateMgr->getStoreManager();
+ 744     return storeMgr.getBinding(storeMgr.getInitialStore(SFC).getStore(),
+ 745                                ArgLoc);
NoQ added inline comments.Nov 18 2016, 5:35 PM
include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
739

Rather in the environment. In fact, here we are relying on the store to *always* have something for us, even if wasn't directly bound earlier.

NoQ commandeered this revision.Nov 30 2016, 12:02 AM
NoQ edited reviewers, added: k-wisniewski; removed: NoQ.

Seems to become outdated with D27091.

NoQ abandoned this revision.Nov 30 2016, 12:02 AM