mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 23:20:40 +03:00
Fix regression with LLVM 13+: some errors in inline assembly don't stop compilation (#4331)
Based on Luís' #4302; fixes #4293.
This commit is contained in:
parent
d89c00c097
commit
7d3f5bae2a
3 changed files with 26 additions and 2 deletions
|
@ -161,8 +161,13 @@ bool inlineAsmDiagnostic(IRState *irs, const llvm::SMDiagnostic &d,
|
|||
#if LDC_LLVM_VER < 1300
|
||||
void inlineAsmDiagnosticHandler(const llvm::SMDiagnostic &d, void *context,
|
||||
unsigned locCookie) {
|
||||
if (d.getKind() == llvm::SourceMgr::DK_Error)
|
||||
if (d.getKind() == llvm::SourceMgr::DK_Error) {
|
||||
++global.errors;
|
||||
} else if (global.params.warnings == DIAGNOSTICerror &&
|
||||
d.getKind() == llvm::SourceMgr::DK_Warning) {
|
||||
++global.warnings;
|
||||
}
|
||||
|
||||
inlineAsmDiagnostic(static_cast<IRState *>(context), d, locCookie);
|
||||
}
|
||||
#else
|
||||
|
@ -176,8 +181,15 @@ struct InlineAsmDiagnosticHandler : public llvm::DiagnosticHandler {
|
|||
return false;
|
||||
|
||||
const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
|
||||
if (DISM.getKind() == llvm::SourceMgr::DK_Error)
|
||||
if (DISM.getKind() == llvm::SourceMgr::DK_Error ||
|
||||
DISM.getSeverity() == llvm::DS_Error) {
|
||||
++global.errors;
|
||||
} else if (global.params.warnings == DIAGNOSTICerror &&
|
||||
(DISM.getKind() == llvm::SourceMgr::DK_Warning ||
|
||||
DISM.getSeverity() == llvm::DS_Warning)) {
|
||||
++global.warnings;
|
||||
}
|
||||
|
||||
return inlineAsmDiagnostic(irs, DISM.getSMDiag(), DISM.getLocCookie());
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue