diff options
Diffstat (limited to 'llvm/tools/llvm-link/llvm-link.cpp')
| -rw-r--r-- | llvm/tools/llvm-link/llvm-link.cpp | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index 805ea73b3f6..568e5f8d2d5 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -182,30 +182,25 @@ Module &ModuleLazyLoaderCache::operator()(const char *argv0, } } // anonymous namespace -namespace { -struct LLVMLinkDiagnosticHandler : public DiagnosticHandler { - bool handleDiagnostics(const DiagnosticInfo &DI) override { - unsigned Severity = DI.getSeverity(); - switch (Severity) { - case DS_Error: - errs() << "ERROR: "; - break; - case DS_Warning: - if (SuppressWarnings) - return true; - errs() << "WARNING: "; - break; - case DS_Remark: - case DS_Note: - llvm_unreachable("Only expecting warnings and errors"); - } - - DiagnosticPrinterRawOStream DP(errs()); - DI.print(DP); - errs() << '\n'; - return true; +static void diagnosticHandler(const DiagnosticInfo &DI, void *C) { + unsigned Severity = DI.getSeverity(); + switch (Severity) { + case DS_Error: + errs() << "ERROR: "; + break; + case DS_Warning: + if (SuppressWarnings) + return; + errs() << "WARNING: "; + break; + case DS_Remark: + case DS_Note: + llvm_unreachable("Only expecting warnings and errors"); } -}; + + DiagnosticPrinterRawOStream DP(errs()); + DI.print(DP); + errs() << '\n'; } /// Import any functions requested via the -import option. @@ -352,8 +347,8 @@ int main(int argc, char **argv) { ExitOnErr.setBanner(std::string(argv[0]) + ": "); LLVMContext Context; - Context.setDiagnosticHandler( - llvm::make_unique<LLVMLinkDiagnosticHandler>(), true); + Context.setDiagnosticHandler(diagnosticHandler, nullptr, true); + llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); |

