[PATCH] D156429: [TableGen] Add new bang operator !format
Michael Maitland via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 08:51:43 PDT 2023
michaelmaitland added inline comments.
================
Comment at: llvm/test/TableGen/format.td:23
+ string formatInterleave = !format("{0} {1} {0}", 0, 1);
+ string formatNoArg = !format("");
+ string formatLessArgs = !format("{0} {1}", 0);
----------------
wangpc wrote:
> michaelmaitland wrote:
> > What happens for something like:
> >
> > `!format("{}")` or `format!("{1} {} {0} {}", 1, 2);`
> `!format("{}")`->`"{}"`
> `!format("{1} {} {0} {}", 1, 2)`->`2 {} 1 {}`
>
> Currently, I haven't implemented the format specifier `{}`, the only supported one is `{i}`.
> The implementation of this patch is very simple, I hope we can delegate formatting to `std::vformat` someday, but `std::vformat` needs C++ 20.
Can we add a test case for now so it is clear how this behaves? I am fine with delaying the change of how these act to be closer to std::vformat in the future.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156429/new/
https://reviews.llvm.org/D156429
More information about the llvm-commits
mailing list