ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
nested_func_transform.h File Reference
#include <optional>
#include <string>
#include <util/base/filesystem.h>
Include dependency graph for nested_func_transform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::optional< file_operations::tmp_file > transform_nested_functions (const std::string &source_path)
 Transforms GCC nested function definitions in a C source file into standard C by lambda-lifting them to file scope.

Function Documentation

◆ transform_nested_functions()

std::optional< file_operations::tmp_file > transform_nested_functions ( const std::string & source_path)

Transforms GCC nested function definitions in a C source file into standard C by lambda-lifting them to file scope.

Captured variables from enclosing scopes become explicit pointer parameters (for direct calls) or file-scope static pointer variables (when the nested function is used as a function pointer).

Returns nullopt if no nested functions are detected (fast no-op). Otherwise returns a tmp_file whose path() contains the transformed source. The caller should pass that path to Clang instead of the original.