diff options
| author | 2018-04-06 14:26:03 +0000 | |
|---|---|---|
| committer | 2018-04-06 14:26:03 +0000 | |
| commit | bdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch) | |
| tree | c50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/tools/llvm-link/llvm-link.cpp | |
| parent | Print a 'p' flag for file descriptors that were opened after pledge(2). (diff) | |
| download | wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip | |
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/tools/llvm-link/llvm-link.cpp')
| -rw-r--r-- | gnu/llvm/tools/llvm-link/llvm-link.cpp | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/gnu/llvm/tools/llvm-link/llvm-link.cpp b/gnu/llvm/tools/llvm-link/llvm-link.cpp index 568e5f8d2d5..50f506aeaae 100644 --- a/gnu/llvm/tools/llvm-link/llvm-link.cpp +++ b/gnu/llvm/tools/llvm-link/llvm-link.cpp @@ -182,25 +182,30 @@ Module &ModuleLazyLoaderCache::operator()(const char *argv0, } } // anonymous namespace -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"); - } +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'; + DiagnosticPrinterRawOStream DP(errs()); + DI.print(DP); + errs() << '\n'; + return true; + } +}; } /// Import any functions requested via the -import option. @@ -347,8 +352,8 @@ int main(int argc, char **argv) { ExitOnErr.setBanner(std::string(argv[0]) + ": "); LLVMContext Context; - Context.setDiagnosticHandler(diagnosticHandler, nullptr, true); - + Context.setDiagnosticHandler( + llvm::make_unique<LLVMLinkDiagnosticHandler>(), true); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); @@ -378,7 +383,7 @@ int main(int argc, char **argv) { if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite; std::error_code EC; - tool_output_file Out(OutputFilename, EC, sys::fs::F_None); + ToolOutputFile Out(OutputFilename, EC, sys::fs::F_None); if (EC) { errs() << EC.message() << '\n'; return 1; |
