static void linkerDiagnosticHandlerNoCtx(const llvm::DiagnosticInfo &DI) { if (DI.getSeverity() != llvm::DS_Error) return; std::string MsgStorage; { llvm::raw_string_ostream Stream(MsgStorage); llvm::DiagnosticPrinterRawOStream DP(Stream); DI.print(DP); } llvm::errs() << "Error linking swift modules\n"; llvm::errs() << MsgStorage << "\n"; }
static void linkerDiagnosticHandler(const llvm::DiagnosticInfo &DI, void *Context) { // This assert self documents our precondition that Context is always // nullptr. It seems that parts of LLVM are using the flexibility of having a // context. We don't really care about this. assert(Context == nullptr && "We assume Context is always a nullptr"); if (DI.getSeverity() != llvm::DS_Error) return; std::string MsgStorage; { llvm::raw_string_ostream Stream(MsgStorage); llvm::DiagnosticPrinterRawOStream DP(Stream); DI.print(DP); } llvm::errs() << "Error linking swift modules\n"; llvm::errs() << MsgStorage << "\n"; }