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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 08:44:14 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;
----------------
topperc wrote:

Why can't we move the quote from the `Error` line to the `TypedInt` `InitType` string like

```
    if (const auto *BI = dyn_cast<BitsInit>(V))
      InitType = (Twine("' of type bit initializer with length ") +
                  Twine(BI->getNumBits())).str();
    else if (const auto *TI = dyn_cast<TypedInit>(V))
      InitType = (Twine("' of type '") + TI->getType()->getAsString()).str() + "'";
    return Error(Loc, "Field '" + ValName->getAsUnquotedString() +
                          "' of type '" + RV->getType()->getAsString() +
                          "' is incompatible with value '" + V->getAsString() +
                          InitType);
```

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


More information about the llvm-commits mailing list