[llvm] 6746602 - [MC] Improve .subsection diagnostic
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 18:35:55 PDT 2023
Author: Fangrui Song
Date: 2023-06-15T18:35:51-07:00
New Revision: 6746602bc6427300735af52284928c4a8c84875b
URL: https://github.com/llvm/llvm-project/commit/6746602bc6427300735af52284928c4a8c84875b
DIFF: https://github.com/llvm/llvm-project/commit/6746602bc6427300735af52284928c4a8c84875b.diff
LOG: [MC] Improve .subsection diagnostic
Added:
Modified:
llvm/lib/MC/MCObjectStreamer.cpp
llvm/test/MC/ELF/subsection.s
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index ea9c1f174197b..64fbe618b57f2 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -379,7 +379,8 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
}
if (!isUInt<31>(IntSubsection)) {
getContext().reportError(Subsection->getLoc(),
- "subsection number must be within [0,2147483647]");
+ "subsection number " + Twine(IntSubsection) +
+ " is not within [0,2147483647]");
}
CurSubsectionIdx = unsigned(IntSubsection);
diff --git a/llvm/test/MC/ELF/subsection.s b/llvm/test/MC/ELF/subsection.s
index 5381568d4dd1b..57e976d33477f 100644
--- a/llvm/test/MC/ELF/subsection.s
+++ b/llvm/test/MC/ELF/subsection.s
@@ -42,9 +42,9 @@ l2:
// ERR: :[[#@LINE+1]]:13: error: cannot evaluate subsection number
.subsection l2
-// ERR: <unknown>:0: error: subsection number must be within [0,2147483647]
+// ERR: <unknown>:0: error: subsection number -1 is not within [0,2147483647]
.subsection 0-1
.subsection 2147483647
-// ERR: <unknown>:0: error: subsection number must be within [0,2147483647]
+// ERR: <unknown>:0: error: subsection number 2147483648 is not within [0,2147483647]
.subsection 2147483648
.endif
More information about the llvm-commits
mailing list