[PATCH] D127851: [TableGen] Add optional default value for !cast

Wang Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 06:01:39 PDT 2022


pcwang-thead created this revision.
pcwang-thead added reviewers: tra, nhaehnle, craig.topper, jdoerfert.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
pcwang-thead requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Sometimes we want to get a default value instead of error
raised by TableGen when casting a string to a record, so
we add an optional second parameter to !cast operator as
default value.

If casting fails and default value is specified, we will
get default value and TableGen won't raise any error. If
there is no specified default value, the behivior is the
same as before.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127851

Files:
  llvm/docs/TableGen/ProgRef.rst
  llvm/include/llvm/TableGen/Record.h
  llvm/lib/TableGen/Record.cpp
  llvm/lib/TableGen/TGParser.cpp
  llvm/test/TableGen/cast-with-default-value-of-wrong-type.td
  llvm/test/TableGen/cast-with-default-value.td
  llvm/test/TableGen/cast-without-default-value.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127851.437123.patch
Type: text/x-patch
Size: 17218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220615/99c7bcde/attachment.bin>


More information about the llvm-commits mailing list