[clang] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #115823)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 00:42:43 PST 2024


usx95 wrote:

Looks like I have not fully resolved the memory leak and only avoided it by having larger portion of vector on stack.


The leak happens for the allocation: 
```
SmallVector<IdentifierInfo *> ParamIdents;
ParamIdents.push_back(IdLoc->Ident); // <- allocated here.
```

Suprisingly commenting out the `move` makes things go back to normal.
`  // CapturedBy->setArgs(std::move(ParamIdents), std::move(ParamLocs));`

https://github.com/llvm/llvm-project/pull/115823


More information about the cfe-commits mailing list