[llvm] [mlir] [TableGen] Add assert to validate `Objects` list for `HwModeSelect` (PR #123794)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 08:23:43 PST 2025


================
@@ -282,15 +282,18 @@ bool TGParser::SetValue(Record *CurRec, SMLoc Loc, const Init *ValName,
 
   if (OverrideDefLoc ? RV->setValue(V, Loc) : RV->setValue(V)) {
     std::string InitType;
-    if (const auto *BI = dyn_cast<BitsInit>(V))
+    bool LastSingleQuote = true;
----------------
jurahul wrote:

See the BitsInitsErrors.td test that was added: The error printed for BitsInit is:

error: Field 'a' of type 'bits<2>' is incompatible with value '{ opc{1}, opc{0}, opc2{1}, opc2{0} }' of type bit initializer with length 4

The `LastSingleQuote` = false is to avoid printing a stray ' at the end. Without that, the error message is:

error: Field 'a' of type 'bits<2>' is incompatible with value '{ opc{1}, opc{0}, opc2{1}, opc2{0} }' of type bit initializer with length 4'


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


More information about the llvm-commits mailing list