================ @@ -14,6 +14,13 @@ void free(void *); void __attribute((ownership_takes(malloc, 1))) my_free(void *); +void __attribute((ownership_returns(malloc1))) *my_malloc1(size_t); ---------------- steakhal wrote:
What happens if you have a forward declaration to a malloc function without the attribute, then later have another redeclaration with the `ownership_returns` attribute? A similar case to test would be the opposite: 1st declaration has the attribute, the second redeclaration would not have the attribute. I suspect that the FunctionDecl of the callees will refer to the last seen declaration of the function, thus, will not recognize the attribute for the second case I mentioned here. Could you test these cases? https://github.com/llvm/llvm-project/pull/98941 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits