[PATCH] D148915: [TableGen] Introduce function and lambda

Wang Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 19:45:00 PDT 2023


pcwang-thead added inline comments.


================
Comment at: llvm/docs/TableGen/ProgRef.rst:727
+   specified in the function argument list when the function is called.
+2. Optional argument: if an argument is assigned a default value, then it need
+   not be specified in the argument list.
----------------
michaelmaitland wrote:
> Are multiple optional arguments supported? They are for classes that are used as subroutines.
> 
> If so, can we document how to pass optional arguments that are not first in the list of optional arguments? For example some languages allow `f(int a, optional int b = 2, optional int c = 3); f(3, c=4);`. Does it work like this or do we need to pass `b` if we want to pass `c`?
Yes, they are the same as class-based subroutines.

Currently, we should pass optional argument `b` if we want to pass optional argument `c` as what you said. This is the same as arguments of classes. I have thought about something like `f(3, c: 4)` since we have something like `cond: value` in bang operator `!cond` already. I will post this implementation in a few days.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148915/new/

https://reviews.llvm.org/D148915



More information about the llvm-commits mailing list