[PATCH] D149016: [TableGen] Make defvar prior to class template arguments

Wang Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 23 02:50:27 PDT 2023


pcwang-thead created this revision.
pcwang-thead added reviewers: simon_tatham, tra, nhaehnle, craig.topper.
Herald added a subscriber: hiraditya.
Herald added a project: All.
pcwang-thead requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In D148197 <https://reviews.llvm.org/D148197>, we have make `defvar` statement able to refer class
template arguments. However, the priority of class/multiclass
template arguments are higher then variables defined by defvar,
which is a little counterintuitive.

In this patch, we make variables defined by `defvar` prior to
class/multiclass template arguments. The shadow rules now are:

- `V` in a record body shadows a global `V`.

- `V` in a record body shadows template argument `V`.

- `V` in template arguments shadows a global `V`.

- `V` in a `foreach`` statement list shadows any `V` in surrounding

record or global scopes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149016

Files:
  llvm/docs/TableGen/ProgRef.rst
  llvm/lib/TableGen/TGParser.cpp
  llvm/lib/TableGen/TGParser.h
  llvm/test/TableGen/defvar.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149016.516136.patch
Type: text/x-patch
Size: 4737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230423/d687838a/attachment.bin>


More information about the llvm-commits mailing list