[llvm] [AVR] Force relocations for non-encodable jumps (PR #121498)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 00:36:57 PST 2025


================
@@ -31,60 +31,72 @@ namespace adjust {
 
 using namespace llvm;
 
-static void signed_width(unsigned Width, uint64_t Value,
-                         std::string Description, const MCFixup &Fixup,
-                         MCContext *Ctx) {
-  if (!isIntN(Width, Value)) {
-    std::string Diagnostic = "out of range " + Description;
+static bool checkSignedWidth(unsigned Width, uint64_t Value,
+                             std::string Description, const MCFixup &Fixup,
+                             MCContext *Ctx) {
+  if (isIntN(Width, Value)) {
+    return true;
+  }
 
+  if (Ctx) {
     int64_t Min = minIntN(Width);
     int64_t Max = maxIntN(Width);
 
-    Diagnostic += " (expected an integer in the range " + std::to_string(Min) +
-                  " to " + std::to_string(Max) + ")";
-
-    Ctx->reportError(Fixup.getLoc(), Diagnostic);
+    Ctx->reportError(Fixup.getLoc(), Twine("out of range ") + Description +
----------------
arsenm wrote:

Missing error test 

https://github.com/llvm/llvm-project/pull/121498


More information about the llvm-commits mailing list