Skip to content

facebook/infer

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Summary:
When lambdas are passed to a function as an argument, and the closure itself is passed, then the analysis doesn't work so well. We need to first evaluate the closure, which basically "initialises the closure object" and sets values of the captured variables as fields. So here we add a transformation

```
    f(closure) ---> temp = closure; f(temp)
```

for general function calls because they expect a pointer to a closure

```
    f(closure) ---> temp = closure; n = temp; f(n)
```

for `operator()` and `std::function::function`

because they expect the actual closure.

The first transformation will improve the analysis: f(closure) was not working properly. The second transformation will improve readability of the translation. Better to evaluate the closure first before passing it to a function.

By the way, often the frontend was doing this already, but it depends on very subtle changes whether a `MaterializeTemporaryExpr` was in the AST or not.

Reviewed By: skcho

Differential Revision: D48189083

fbshipit-source-id: e33dbf694a8e3ba15a4e5bdabe0d1349a7c165db
657c162

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
February 28, 2023 03:18
June 13, 2019 00:20
April 18, 2023 02:53
September 10, 2020 02:35
September 8, 2020 09:38
January 31, 2017 15:18
March 6, 2023 03:20
June 13, 2019 00:20
July 12, 2023 05:52
November 4, 2021 06:24

logo

Infer build website

Infer is a static analysis tool for Java, C++, Objective-C, and C. Infer is written in OCaml.

Installation

Read our Getting Started page for details on how to install packaged versions of Infer. To build Infer from source, see INSTALL.md.

Contributing

See CONTRIBUTING.md.

License

Infer is MIT-licensed.

Note: Enabling Java support may require you to download and install components licensed under the GPL.