Mercurial > hg > CbC > CbC_llvm
diff tools/bugpoint/ExtractFunction.cpp @ 147:c2174574ed3a
LLVM 10
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 16:55:33 +0900 |
parents | 3a76565eade5 |
children |
line wrap: on
line diff
--- a/tools/bugpoint/ExtractFunction.cpp Sat Feb 17 09:57:20 2018 +0900 +++ b/tools/bugpoint/ExtractFunction.cpp Wed Aug 14 16:55:33 2019 +0900 @@ -1,9 +1,8 @@ //===- ExtractFunction.cpp - Extract a function from Program --------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -127,7 +126,8 @@ } std::unique_ptr<Module> -BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) { +BugDriver::performFinalCleanups(std::unique_ptr<Module> M, + bool MayModifySemantics) { // Make all functions external, so GlobalDCE doesn't delete them... for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) I->setLinkage(GlobalValue::ExternalLinkage); @@ -140,12 +140,11 @@ else CleanupPasses.push_back("deadargelim"); - std::unique_ptr<Module> New = runPassesOn(M, CleanupPasses); + std::unique_ptr<Module> New = runPassesOn(M.get(), CleanupPasses); if (!New) { errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n"; return nullptr; } - delete M; return New; } @@ -324,9 +323,9 @@ std::set<Function *> TestFunctions; for (unsigned i = 0, e = F.size(); i != e; ++i) { Function *TNOF = cast<Function>(VMap[F[i]]); - DEBUG(errs() << "Removing function "); - DEBUG(TNOF->printAsOperand(errs(), false)); - DEBUG(errs() << "\n"); + LLVM_DEBUG(errs() << "Removing function "); + LLVM_DEBUG(TNOF->printAsOperand(errs(), false)); + LLVM_DEBUG(errs() << "\n"); TestFunctions.insert(cast<Function>(NewVMap[TNOF])); DeleteFunctionBody(TNOF); // Function is now external in this module! }