summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/Miscompilation.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-12-14 23:17:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-12-14 23:17:03 +0000
commit9d2bfc48741a5c0c3a3eb455959a627afcc3b722 (patch)
treefe5cca4dadc85dbb69e9636da588d269ba63b92c /llvm/tools/bugpoint/Miscompilation.cpp
parent2cb8a51c1f771437a0207c4c71e2d6273a4a3550 (diff)
downloadbcm5719-llvm-9d2bfc48741a5c0c3a3eb455959a627afcc3b722.tar.gz
bcm5719-llvm-9d2bfc48741a5c0c3a3eb455959a627afcc3b722.zip
Use diagnostic handler in the LLVMContext
This patch converts code that has access to a LLVMContext to not take a diagnostic handler. This has a few advantages * It is easier to use a consistent diagnostic handler in a single program. * Less clutter since we are not passing a handler around. It does make it a bit awkward to implement some C APIs that return a diagnostic string. I will propose new versions of these APIs and deprecate the current ones. llvm-svn: 255571
Diffstat (limited to 'llvm/tools/bugpoint/Miscompilation.cpp')
-rw-r--r--llvm/tools/bugpoint/Miscompilation.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp
index 5c9f0271cec..2c64e372256 100644
--- a/llvm/tools/bugpoint/Miscompilation.cpp
+++ b/llvm/tools/bugpoint/Miscompilation.cpp
@@ -18,7 +18,6 @@
#include "llvm/Config/config.h" // for HAVE_LINK_R
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
-#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
@@ -211,14 +210,6 @@ namespace {
};
}
-static void diagnosticHandler(const DiagnosticInfo &DI) {
- DiagnosticPrinterRawOStream DP(errs());
- DI.print(DP);
- errs() << '\n';
- if (DI.getSeverity() == DS_Error)
- exit(1);
-}
-
/// Given two modules, link them together and run the program, checking to see
/// if the program matches the diff. If there is an error, return NULL. If not,
/// return the merged module. The Broken argument will be set to true if the
@@ -230,7 +221,7 @@ static std::unique_ptr<Module> testMergedProgram(const BugDriver &BD,
std::unique_ptr<Module> M2,
std::string &Error,
bool &Broken) {
- if (Linker::linkModules(*M1, *M2, diagnosticHandler))
+ if (Linker::linkModules(*M1, *M2))
exit(1);
// Execute the program.
@@ -396,8 +387,7 @@ static bool ExtractLoops(BugDriver &BD,
MisCompFunctions.emplace_back(F->getName(), F->getFunctionType());
}
- if (Linker::linkModules(*ToNotOptimize, *ToOptimizeLoopExtracted,
- diagnosticHandler))
+ if (Linker::linkModules(*ToNotOptimize, *ToOptimizeLoopExtracted))
exit(1);
MiscompiledFunctions.clear();
@@ -424,8 +414,7 @@ static bool ExtractLoops(BugDriver &BD,
// extraction both didn't break the program, and didn't mask the problem.
// Replace the current program with the loop extracted version, and try to
// extract another loop.
- if (Linker::linkModules(*ToNotOptimize, *ToOptimizeLoopExtracted,
- diagnosticHandler))
+ if (Linker::linkModules(*ToNotOptimize, *ToOptimizeLoopExtracted))
exit(1);
// All of the Function*'s in the MiscompiledFunctions list are in the old
@@ -593,7 +582,7 @@ static bool ExtractBlocks(BugDriver &BD,
if (!I->isDeclaration())
MisCompFunctions.emplace_back(I->getName(), I->getFunctionType());
- if (Linker::linkModules(*ProgClone, *Extracted, diagnosticHandler))
+ if (Linker::linkModules(*ProgClone, *Extracted))
exit(1);
// Set the new program and delete the old one.
OpenPOWER on IntegriCloud