From af8a5d74d66383afe043a42c44771a79a6622264 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Tue, 21 May 2019 17:55:26 +0000 Subject: [PATCH] [Bugpoint] fix use-after-move. NFC Summary: This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No. 6". Note that author also states: "Note that the loop doesn't actually execute at all." This is not true, but the author can be forgiven; there's two distinct variables with very similar identifiers: MiscompiledFunctions MisCompFunctions Reviewers: echristo, srhines, RKSimon Reviewed By: RKSimon Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62113 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361279 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/Miscompilation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index b7477149c61..56fb015bdcc 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -591,9 +591,6 @@ ExtractBlocks(BugDriver &BD, if (Linker::linkModules(*ProgClone, std::move(Extracted))) exit(1); - // Set the new program and delete the old one. - BD.setNewProgram(std::move(ProgClone)); - // Update the list of miscompiled functions. MiscompiledFunctions.clear(); @@ -603,6 +600,9 @@ ExtractBlocks(BugDriver &BD, MiscompiledFunctions.push_back(NewF); } + // Set the new program and delete the old one. + BD.setNewProgram(std::move(ProgClone)); + return true; } -- 2.50.1