[PATCH] D147993: Add delete to fix resource leak in llc.cpp
Wang, Xin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 18:46:10 PDT 2023
XinWang10 added inline comments.
================
Comment at: llvm/tools/llc/llc.cpp:702
<< "run-pass is for .mir file only.\n";
+ delete MMIWP;
return 1;
----------------
craig.topper wrote:
> Why is it only a leak on these paths? The are other `return 1` in this function.
>
> Can we use std::unique_ptr where these are created?
1. MMIWP and TPC will be maintained by PM here at line 717, 718. I remember that PM's destructor will handle them.
2. MMIWP and TPC will be used as parameters for function like PM.add or arget->addPassesToEmitFile() in line 727, if we use unique_ptr, we need to handle more complicated issues.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147993/new/
https://reviews.llvm.org/D147993
More information about the llvm-commits
mailing list