This patch adds a function attribute, nofree, to indicate that a function does not, directly or indirectly, call a memory-deallocation function (e.g., free, C++'s operator delete).
The primary motivation for adding this attribute some from the discussion about how to fix the semantics, or the use of, the dereferenceable attribute on C++ references passed as function parameters. The problem is that, while a reference argument is known to be dereferenceable when the function starts executing, nothing prevents the function from freeing the memory. As a result, it is wrong to assume that the pointer is dereferenceable over the entire body of the function unless we can rule out a situation where the memory might be deallocated during the course of the function's execution. For more information, please see the discussion in https://reviews.llvm.org/D48239.
For more information, see the RFC.