summaryrefslogtreecommitdiffstats
path: root/llvm/tools/lto/lto.cpp
diff options
context:
space:
mode:
authorVivek Pandya <vivekvpandya@gmail.com>2017-09-15 19:53:54 +0000
committerVivek Pandya <vivekvpandya@gmail.com>2017-09-15 19:53:54 +0000
commitdf8598dcc46bde61fd70e2a39b6b8a067cc8be4a (patch)
tree2e1611061b39e36c315db9964457895cf2770aaa /llvm/tools/lto/lto.cpp
parent8b0bbc6fe03b50a87312902ed9ae2a09c5735889 (diff)
downloadbcm5719-llvm-df8598dcc46bde61fd70e2a39b6b8a067cc8be4a.tar.gz
bcm5719-llvm-df8598dcc46bde61fd70e2a39b6b8a067cc8be4a.zip
This reverts r313381
llvm-svn: 313387
Diffstat (limited to 'llvm/tools/lto/lto.cpp')
-rw-r--r--llvm/tools/lto/lto.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index 11885211797..1b218a64cbf 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/tools/lto/lto.cpp
@@ -75,23 +75,20 @@ static bool parsedOptions = false;
static LLVMContext *LTOContext = nullptr;
-struct LTOToolDiagnosticHandler : public DiagnosticHandler {
- bool handleDiagnostics(const DiagnosticInfo &DI) override {
- if (DI.getSeverity() != DS_Error) {
- DiagnosticPrinterRawOStream DP(errs());
- DI.print(DP);
- errs() << '\n';
- return true;
- }
- sLastErrorString = "";
- {
- raw_string_ostream Stream(sLastErrorString);
- DiagnosticPrinterRawOStream DP(Stream);
- DI.print(DP);
- }
- return true;
+static void diagnosticHandler(const DiagnosticInfo &DI, void *Context) {
+ if (DI.getSeverity() != DS_Error) {
+ DiagnosticPrinterRawOStream DP(errs());
+ DI.print(DP);
+ errs() << '\n';
+ return;
}
-};
+ sLastErrorString = "";
+ {
+ raw_string_ostream Stream(sLastErrorString);
+ DiagnosticPrinterRawOStream DP(Stream);
+ DI.print(DP);
+ }
+}
// Initialize the configured targets if they have not been initialized.
static void lto_initialize() {
@@ -111,8 +108,7 @@ static void lto_initialize() {
static LLVMContext Context;
LTOContext = &Context;
- LTOContext->setDiagnosticHandler(
- llvm::make_unique<LTOToolDiagnosticHandler>(), true);
+ LTOContext->setDiagnosticHandler(diagnosticHandler, nullptr, true);
initialized = true;
}
}
@@ -278,8 +274,7 @@ lto_module_t lto_module_create_in_local_context(const void *mem, size_t length,
// Create a local context. Ownership will be transferred to LTOModule.
std::unique_ptr<LLVMContext> Context = llvm::make_unique<LLVMContext>();
- Context->setDiagnosticHandler(llvm::make_unique<LTOToolDiagnosticHandler>(),
- true);
+ Context->setDiagnosticHandler(diagnosticHandler, nullptr, true);
ErrorOr<std::unique_ptr<LTOModule>> M = LTOModule::createInLocalContext(
std::move(Context), mem, length, Options, StringRef(path));
OpenPOWER on IntegriCloud