| 2040 | } |
| 2041 | |
| 2042 | void LlvmCodeGen::DiagnosticHandler::DiagnosticHandlerFn( |
| 2043 | const llvm::DiagnosticInfo& info, void* context) { |
| 2044 | if (info.getSeverity() == llvm::DiagnosticSeverity::DS_Error) { |
| 2045 | LlvmCodeGen* codegen = reinterpret_cast<LlvmCodeGen*>(context); |
| 2046 | codegen->diagnostic_handler_.error_str_.clear(); |
| 2047 | llvm::raw_string_ostream error_msg(codegen->diagnostic_handler_.error_str_); |
| 2048 | llvm::DiagnosticPrinterRawOStream diagnostic_printer(error_msg); |
| 2049 | diagnostic_printer << "LLVM diagnostic error: "; |
| 2050 | info.print(diagnostic_printer); |
| 2051 | error_msg.flush(); |
| 2052 | if (codegen->state_) { |
| 2053 | LOG(INFO) << "Query " << PrintId(codegen->state_->query_id()) << " encountered a " |
| 2054 | << codegen->diagnostic_handler_.error_str_; |
| 2055 | } |
| 2056 | } |
| 2057 | } |
| 2058 | |
| 2059 | string LlvmCodeGen::DiagnosticHandler::GetErrorString() { |
| 2060 | if (!error_str_.empty()) { |