[all-commits] [llvm/llvm-project] fd5d0a: [TableGen] Allow references to class template argu...

Wang Pengcheng via All-commits all-commits at lists.llvm.org
Thu Apr 13 20:17:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fd5d0a88dde007728004e43cb28f3c8c0be7b97c
      https://github.com/llvm/llvm-project/commit/fd5d0a88dde007728004e43cb28f3c8c0be7b97c
  Author: wangpc <pc.wang at linux.alibaba.com>
  Date:   2023-04-14 (Fri, 14 Apr 2023)

  Changed paths:
    M llvm/lib/TableGen/TGParser.cpp
    M llvm/lib/TableGen/TGParser.h
    M llvm/test/TableGen/defvar.td

  Log Message:
  -----------
  [TableGen] Allow references to class template arguments in defvar

We can't refer to template arguments for defvar statements in class
definitions, or it will report some errors like:

```
error: Variable not defined: 'xxx'.
```

The key point here is we used to pass nullptr to `ParseValue` in
`ParseDefvar`. As a result, we can't refer to template arguments
since `CurRec` is nullptr in `ParseIDValue`.

So we add an argument `CurRec` to `ParseDefvar` and provide it
when parsing defvar statements in class definitions.

Reviewed By: tra, simon_tatham

Differential Revision: https://reviews.llvm.org/D148197




More information about the All-commits mailing list