ojhunt wrote:

> > I'm not super keen on the fragility of this, do we have cases where this 
> > leak is causing real problems?
> 
> I don't think OpaqueValueExprs are designed to be persistent, and IMO we're 
> trying to prevent future uses (particularly some AI agents from imitating 
> existing examples) that allocate unnecessary things on heap.

I think this is a _very_ bad argument: we're making a change that leads to more 
dangerous code, in order to prevent LLMs from making a different - less bad - 
mistake.

I had assumed that there was a real memory-usage related reason for this change.

If the intent here is not because we think that the existing code is incorrect, 
but because it has a "pattern" that we are worried that LLMs will copy then 
that's a hard no on this PR. 

Heap allocating AST nodes *is* the correct pattern in the overwhelming majority 
of cases, and every case in which we don't has had problems (weird bugs, UAF, 
etc). If anything we should want LLMs to prefer heap allocation over stack 
allocation as the former is overwhelmingly more likely to be correct.

https://github.com/llvm/llvm-project/pull/238243
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to