librustc_llvm: Show PGO diagnostics properly.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
aaeb40ab3b
commit
a95c8c66a7
@ -121,6 +121,7 @@ impl InlineAsmDiagnostic {
|
||||
pub enum Diagnostic {
|
||||
Optimization(OptimizationDiagnostic),
|
||||
InlineAsm(InlineAsmDiagnostic),
|
||||
PGO(DiagnosticInfoRef),
|
||||
|
||||
/// LLVM has other types that we do not wrap here.
|
||||
UnknownDiagnostic(DiagnosticInfoRef),
|
||||
@ -160,6 +161,10 @@ impl Diagnostic {
|
||||
Optimization(OptimizationDiagnostic::unpack(OptimizationFailure, di))
|
||||
}
|
||||
|
||||
Dk::PGOProfile => {
|
||||
PGO(di)
|
||||
}
|
||||
|
||||
_ => UnknownDiagnostic(di),
|
||||
}
|
||||
}
|
||||
|
@ -322,6 +322,7 @@ pub enum DiagnosticKind {
|
||||
OptimizationRemarkAnalysisAliasing,
|
||||
OptimizationRemarkOther,
|
||||
OptimizationFailure,
|
||||
PGOProfile,
|
||||
}
|
||||
|
||||
/// LLVMRustArchiveKind
|
||||
|
@ -498,8 +498,13 @@ unsafe extern "C" fn diagnostic_handler(info: DiagnosticInfoRef, user: *mut c_vo
|
||||
opt.message));
|
||||
}
|
||||
}
|
||||
|
||||
_ => (),
|
||||
llvm::diagnostic::PGO(diagnostic_ref) => {
|
||||
let msg = llvm::build_string(|s| {
|
||||
llvm::LLVMRustWriteDiagnosticInfoToString(diagnostic_ref, s)
|
||||
}).expect("non-UTF8 PGO diagnostic");
|
||||
diag_handler.note_without_error(&msg);
|
||||
}
|
||||
llvm::diagnostic::UnknownDiagnostic(..) => {},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1021,6 +1021,7 @@ enum class LLVMRustDiagnosticKind {
|
||||
OptimizationRemarkAnalysisAliasing,
|
||||
OptimizationRemarkOther,
|
||||
OptimizationFailure,
|
||||
PGOProfile,
|
||||
};
|
||||
|
||||
static LLVMRustDiagnosticKind toRust(DiagnosticKind Kind) {
|
||||
@ -1043,6 +1044,8 @@ static LLVMRustDiagnosticKind toRust(DiagnosticKind Kind) {
|
||||
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisFPCommute;
|
||||
case DK_OptimizationRemarkAnalysisAliasing:
|
||||
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisAliasing;
|
||||
case DK_PGOProfile:
|
||||
return LLVMRustDiagnosticKind::PGOProfile;
|
||||
default:
|
||||
return (Kind >= DK_FirstRemark && Kind <= DK_LastRemark)
|
||||
? LLVMRustDiagnosticKind::OptimizationRemarkOther
|
||||
|
Loading…
Reference in New Issue
Block a user