[PATCH] D127739: [TableGen] Check if input string of !isa is an instance of record type
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 14 10:25:06 PDT 2022
tra added a comment.
Do you have a practical use case where this feature would be needed?
> TableGen will raise an error if failed to cast
This may be considered to be a feature. If you attempt to cast to a record that does not exist, then arguably something went wrong.
While I generally do agree that we don't have a good way to handle non-existing casts, I'm not convinced that `!isa` is the right place to deal with the issue.
E.g. I may want `!isa<R>(x)` to be false for any 'x' that's not an instance of `R`, even if `x` is a string with a value that matches the name of an existing record of `R`?
If we want/need to check whether a record with a given name exists, then we'll probably need a new operator.
Or, perhaps, we should consider extending `!cast` to accept an additional value to be returned if the cast has failed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127739/new/
https://reviews.llvm.org/D127739
More information about the llvm-commits
mailing list