[llvm] [DiagnosticInfo] Fix the default DiagnosticSeverity (PR #120342)

Jinsong Ji via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 17:01:43 PST 2024


https://github.com/jsji created https://github.com/llvm/llvm-project/pull/120342

After
https://github.com/llvm/llvm-project/commit/ea632e1b34e1

the API call to LLVMContext->emitError(I, Errorstr) default to warning
instead of error.

This cause problems as the API mentioned it is "prefixed with error:".


>From 0f7a2cd371afeeb27790f0d8b2d420d2daf62518 Mon Sep 17 00:00:00 2001
From: Jinsong Ji <jinsong.ji at intel.com>
Date: Tue, 17 Dec 2024 16:54:49 -0800
Subject: [PATCH] [DiagnosticInfo] Fix the default DiagnosticSeverity

After
https://github.com/llvm/llvm-project/commit/ea632e1b34e1

the API call to LLVMContext->emitError(I, Errorstr) default to warning
instead of error.

This cause problems as the API mentioned it is "prefixed with error:".
---
 llvm/include/llvm/IR/DiagnosticInfo.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h
index 0d582cc17967e5..694785317af040 100644
--- a/llvm/include/llvm/IR/DiagnosticInfo.h
+++ b/llvm/include/llvm/IR/DiagnosticInfo.h
@@ -150,7 +150,7 @@ class DiagnosticInfoGeneric : public DiagnosticInfo {
       : DiagnosticInfo(DK_Generic, Severity), MsgStr(MsgStr) {}
 
   DiagnosticInfoGeneric(const Instruction *I, const Twine &ErrMsg,
-                        DiagnosticSeverity Severity = DS_Warning)
+                        DiagnosticSeverity Severity = DS_Error)
       : DiagnosticInfo(DK_Generic, Severity), MsgStr(ErrMsg), Inst(I) {}
 
   const Twine &getMsgStr() const { return MsgStr; }



More information about the llvm-commits mailing list