summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Sanders <daniel_l_sanders@apple.com>2019-02-23 03:25:37 +0000
committerDaniel Sanders <daniel_l_sanders@apple.com>2019-02-23 03:25:37 +0000
commit6ac16e91f6dff44cfdd3fc4092a06ea383670c5c (patch)
tree30d9dbf2bd8851b6ae60e11a79171f952a76db54
parentbeb33eb3cfb8ae76d536ed7e0048f5ae5cd9b4d1 (diff)
downloadbcm5719-llvm-6ac16e91f6dff44cfdd3fc4092a06ea383670c5c.tar.gz
bcm5719-llvm-6ac16e91f6dff44cfdd3fc4092a06ea383670c5c.zip
Try again to fix memory leak in r354692
The previous one didn't fix everything. llvm-svn: 354719
-rw-r--r--llvm/unittests/CodeGen/TargetOptionsTest.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/unittests/CodeGen/TargetOptionsTest.cpp b/llvm/unittests/CodeGen/TargetOptionsTest.cpp
index 70ef5e13c1e..6b4d3eda7ee 100644
--- a/llvm/unittests/CodeGen/TargetOptionsTest.cpp
+++ b/llvm/unittests/CodeGen/TargetOptionsTest.cpp
@@ -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> createTargetMachine(bool EnableIPRA) {
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 EnableIPRA) {
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.
OpenPOWER on IntegriCloud