[PATCH] D156497: [BPF] Emit UNDEF rather than constant 0
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 10:37:23 PDT 2023
yonghong-song added a comment.
Based on the discussion with @eddyz87, the following llvm `diagnose` implementation shows why clang will through an error rather than letting compilation continue:
void LLVMContext::diagnose(const DiagnosticInfo &DI) {
if (auto *OptDiagBase = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
if (LLVMRemarkStreamer *RS = getLLVMRemarkStreamer())
RS->emit(*OptDiagBase);
// If there is a report handler, use it.
if (pImpl->DiagHandler &&
(!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) &&
pImpl->DiagHandler->handleDiagnostics(DI))
return;
if (!isDiagnosticEnabled(DI))
return;
// Otherwise, print the message with a prefix based on the severity.
DiagnosticPrinterRawOStream DP(errs());
errs() << getDiagnosticMessagePrefix(DI.getSeverity()) << ": ";
DI.print(DP);
errs() << "\n";
if (DI.getSeverity() == DS_Error)
exit(1);
}
I suspect you might have your own handler like in the below code
if (pImpl->DiagHandler &&
(!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) &&
pImpl->DiagHandler->handleDiagnostics(DI))
return;
If this is the case, in your own handler, you should ensure that if
`DI.getSeverity() == DS_Error` you should do 'exit(1)`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156497/new/
https://reviews.llvm.org/D156497
More information about the llvm-commits
mailing list