aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/TableGen/TGParser.cpp
diff options
context:
space:
mode:
authorRahul Joshi <rjoshi@nvidia.com>2025-01-27 13:44:44 -0800
committerGitHub <noreply@github.com>2025-01-27 13:44:44 -0800
commitaca08a8515d48baff48328df5d54300fc7180bea (patch)
tree9b4e8999eafb6fdc8d66230e643946c99ce58bd0 /llvm/lib/TableGen/TGParser.cpp
parent6578790076fed5467bf613e48f7a0ad2f50f041a (diff)
downloadllvm-aca08a8515d48baff48328df5d54300fc7180bea.zip
llvm-aca08a8515d48baff48328df5d54300fc7180bea.tar.gz
llvm-aca08a8515d48baff48328df5d54300fc7180bea.tar.bz2
[TableGen] Add assert to validate `Objects` list for `HwModeSelect` (#123794)
- Bail out of TableGen if any asserts fail before running the backend. - Add asserts to validate that the `Objects` and `Modes` lists for various `HwModeSelect` subclasses are of same length. - Eliminate equivalent check in CodeGenHWModes.cpp
Diffstat (limited to 'llvm/lib/TableGen/TGParser.cpp')
-rw-r--r--llvm/lib/TableGen/TGParser.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index d2115ab..9a8301c 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -286,11 +286,13 @@ bool TGParser::SetValue(Record *CurRec, SMLoc Loc, const Init *ValName,
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();
+ 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 + "'");
+ "' is incompatible with value '" + V->getAsString() +
+ InitType);
}
return false;
}