Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TableGen] Enhance !range bang operator #66489

Merged
merged 4 commits into from
Sep 27, 2023

Conversation

wangpc-pp
Copy link
Contributor

We add a third argument step to !range bang operator to make it
with the same semantics as range in Python.

step can be negative. step is 1 by default and step can't be
0. If start < end and step is negative, or start > end
and step is positive, the result is an empty list.

@wangpc-pp
Copy link
Contributor Author

Ping.

Copy link
Collaborator

@nhaehnle nhaehnle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a small nit inline, but I'm happy for you to fix that up and submit without re-review as the rest LGTM.

llvm/docs/TableGen/ProgRef.rst Outdated Show resolved Hide resolved
We add a third argument `step` to `!range` bang operator to make it
with the same semantics as `range` in Python.

`step` can be negative. `step` is 1 by default and `step` can't be
0. If `start` < `end` and `step` is negative, or `start` > `end`
and `step` is positive, the result is an empty list.
@wangpc-pp wangpc-pp force-pushed the main-tablegen-enhance-range-operator branch from e4bb68e to 925c742 Compare September 27, 2023 02:59
@github-actions
Copy link

github-actions bot commented Sep 27, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

@wangpc-pp wangpc-pp merged commit df330d7 into llvm:main Sep 27, 2023
2 of 3 checks passed
wangpc-pp added a commit to wangpc-pp/llvm-project that referenced this pull request Sep 27, 2023
To simplify some code.

This PR is stacked on llvm#66489.
legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this pull request Sep 29, 2023
We add a third argument `step` to `!range` bang operator to make it
with the same semantics as `range` in Python.

`step` can be negative. `step` is 1 by default and `step` can't be
0. If `start` < `end` and `step` is negative, or `start` > `end`
and `step` is positive, the result is an empty list.
@wangpc-pp wangpc-pp deleted the main-tablegen-enhance-range-operator branch November 24, 2023 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants