facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.83k stars 2k forks source link

BO: Add caller_procname to ModelEnv and remove proc_desc from OnDemandEnv. #1709

Closed dhauzar closed 1 year ago

dhauzar commented 1 year ago

As suggested by @skcho:

"It could make more sense that adding caller's proc name to ModelEnv, rather than OndemandEnv (which is in Dom.Mem), since the ondemand env is the data for evaluating parameter values on-demand."

Proc_desc in OnDemandEnv is only used when creating a new Allocsite to file the procname of the caller of the function creating the Allocsite. This is needed in order to not end up with two identical allocsites created in two different subprograms by the call to the same builtin. In these situations, we either have already the correct procname (we don't need to get it from OnDemandEnv) or ModeEnv is available and we could add the procname to ModeEnv.

Please see CONTRIBUTING.md for how to set up your development environment and run tests.

skcho commented 1 year ago

Thank you, @dhauzar. Looks great!

facebook-github-bot commented 1 year ago

@skcho has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 year ago

@skcho merged this pull request in facebook/infer@50fbf0e80faad4d91a6de804d29d59f50876f5f9.

dhauzar commented 1 year ago

Thank you, @dhauzar. Looks great!

You are welcome, thanks for upstreaming it!