[clang] Make the `-disable-free` flag more full featured (PR #136213)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 17 21:39:02 PDT 2025


MaskRay wrote:

You might want to change the `DisableFree` default for library uses so that users don't need to specify `-no-disable-free`.

```
  // Clang calls BuryPointer on the internal AST and CodeGen-related elements like TargetMachine.
  // This will cause memory leaks if `compile` is executed many times.
  ci->getCodeGenOpts().DisableFree = false;
  ci->getFrontendOpts().DisableFree = false;
```

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


More information about the cfe-commits mailing list