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

Michael Maitland via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 12:23:44 PDT 2023


michaelmaitland 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.
----------------
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`?


================
Comment at: llvm/include/llvm/TableGen/Record.h:1668
+
+  /// Is this a function argument?
+  bool isReturnValue() const { return Kind == FK_ReturnValue; }
----------------
`/// Is this a return value?`


================
Comment at: llvm/test/TableGen/lambda.td:25
+
+// ---- Test lambda captures variables correctly ---- //
+
----------------
Do we need to test that argument's take precedence over captures?

```
int x = 4;
function<int, int> f = function (int x): int { return x; }
f(5); // Should evaluate to 5, not 4.
```

In the tests below, there is no `int b` that  exists to be captured.


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