[llvm] [SPARC] Parse relocation specifiers in expressions (PR #208933)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 10:09:34 PDT 2026


================
@@ -1768,6 +1771,17 @@ bool SparcAsmParser::matchSparcAsmModifiers(const MCExpr *&EVal,
   return true;
 }
 
+bool SparcAsmParser::parseDataExpr(const MCExpr *&Res) {
+  SMLoc EndLoc;
+  if (!parseOptionalToken(AsmToken::Percent))
+    return Parser.parseExpression(Res);
+  if (matchSparcAsmModifiers(Res, EndLoc))
+    return false;
----------------
s-barannikov wrote:

I'd very much like `matchSparcAsmModifiers` return tri-state ParseStatus. The boolean return value is very confusing considering most `parse*` functions return true on failure, and this one returns true on success.
That would also avoid not very reliable `hasPendingError()` call.


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


More information about the llvm-commits mailing list