cleanup attribute for variables

GNU (gcc) has the variable attribute 'cleanup' (`__attribute__ ((cleanup(f))`) for freeing memory and cleaning up when a variable goes out of scope. It’s extremely useful, as it enables the use of smart pointers (e.g. Redirecting…) and other forms of automatic memory management.

Any chance this could be implemented in clang?

I believe it is already. Are you finding instances where it does not work?