[PATCH] D71474: [TableGen] Introduce an if/then/else statement.

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 16:58:45 PST 2019


hfinkel added a comment.

In D71474#1783762 <https://reviews.llvm.org/D71474#1783762>, @simon_tatham wrote:

> This is a hasty first draft because I'm about to go away for the holidays, and won't have access to this account until the New Year.


This looks like a useful feature.

> It certainly needs documentation, and might also benefit from a refactoring of the mechanism (perhaps the stack of ForeachLoops ought to become a stack of some kind of polymorphic type that can be either a loop or an if).
> 
> This patch applies on top of the `defvar` one (D71407 <https://reviews.llvm.org/D71407>), and in this version, I've made it so that unlike a foreach, an if statement //doesn't// begin a new local-variable scope. I think that might be useful because that way you can conditionally define the same local var in both branches of the if, and then use it afterwards.

I see the use case, but I'm not sure that it's worth breaking the regularity of the scoping scheme.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71474





More information about the llvm-commits mailing list