From ff4aaf0010d11a4c42f58f839336669d5fd7ba03 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 24 Apr 2003 22:23:34 +0000 Subject: Move function from Miscompilation.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5908 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/BugDriver.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/bugpoint/BugDriver.cpp') diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index 05dff34b84..7a2ce26a85 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -27,6 +27,19 @@ std::string getPassesString(const std::vector &Passes) { return Result; } +// DeleteFunctionBody - "Remove" the function by deleting all of it's basic +// blocks, making it external. +// +void DeleteFunctionBody(Function *F) { + // First, break circular use/def chain references... + for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) + I->dropAllReferences(); + + // Next, delete all of the basic blocks. + F->getBasicBlockList().clear(); + + assert(F->isExternal() && "This didn't make the function external!"); +} /// ParseInputFile - Given a bytecode or assembly input filename, parse and /// return it, or return null if not possible. -- cgit v1.2.3