diff options
author | Simon Tatham <simon.tatham@arm.com> | 2020-01-14 09:10:34 +0000 |
---|---|---|
committer | Simon Tatham <simon.tatham@arm.com> | 2020-01-14 10:19:53 +0000 |
commit | ddbc0b1e516407a24d986a1998026f1ac5864270 (patch) | |
tree | 154cb4b6f200af22dd22d1011a856892cf575563 /lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py | |
parent | 3388b0f59dcc7813278c753f96b66229f290cc59 (diff) | |
download | bcm5719-llvm-ddbc0b1e516407a24d986a1998026f1ac5864270.tar.gz bcm5719-llvm-ddbc0b1e516407a24d986a1998026f1ac5864270.zip |
[TableGen] Introduce an if/then/else statement.
Summary:
This allows you to make some of the defs in a multiclass or `foreach`
conditional on an expression computed from the parameters or iteration
variables.
It was already possible to simulate an if statement using a `foreach`
with a dummy iteration variable and a list constructed using `!if` so
that it had length 0 or 1 depending on the condition, e.g.
foreach unusedIterationVar = !if(condition, [1], []<int>) in { ... }
But this syntax is nicer to read, and also more convenient because it
allows an else clause.
To avoid upheaval in the implementation, I've implemented `if` as pure
syntactic sugar on the `foreach` implementation: internally, `ParseIf`
actually does construct exactly the kind of foreach shown above (and
another reversed one for the else clause if present).
Reviewers: nhaehnle, hfinkel
Reviewed By: hfinkel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71474
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py')
0 files changed, 0 insertions, 0 deletions