[llvm] r354719 - Try again to fix memory leak in r354692
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 22 19:25:37 PST 2019
Author: dsanders
Date: Fri Feb 22 19:25:37 2019
New Revision: 354719
URL: http://llvm.org/viewvc/llvm-project?rev=354719&view=rev
Log:
Try again to fix memory leak in r354692
The previous one didn't fix everything.
Modified:
llvm/trunk/unittests/CodeGen/TargetOptionsTest.cpp
Modified: llvm/trunk/unittests/CodeGen/TargetOptionsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/TargetOptionsTest.cpp?rev=354719&r1=354718&r2=354719&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/TargetOptionsTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/TargetOptionsTest.cpp Fri Feb 22 19:25:37 2019
@@ -1,4 +1,5 @@
#include "llvm/Target/TargetOptions.h"
+#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/TargetRegistry.h"
@@ -43,7 +44,6 @@ std::unique_ptr<TargetMachine> createTar
typedef std::function<void(bool)> TargetOptionsTest;
static void targetOptionsTest(bool EnableIPRA) {
- LLVMContext Context;
std::unique_ptr<TargetMachine> TM = createTargetMachine(EnableIPRA);
// This test is designed for the X86 backend; stop if it is not available.
if (!TM)
@@ -51,10 +51,12 @@ static void targetOptionsTest(bool Enabl
legacy::PassManager PM;
LLVMTargetMachine *LLVMTM = static_cast<LLVMTargetMachine *>(TM.get());
- TargetPassConfig &TPC = *LLVMTM->createPassConfig(PM);
+ TargetPassConfig *TPC = LLVMTM->createPassConfig(PM);
(void)TPC;
ASSERT_TRUE(TM->Options.EnableIPRA == EnableIPRA);
+
+ delete TPC;
}
} // End of anonymous namespace.
More information about the llvm-commits
mailing list