[PATCH] D109359: [TableGen] Optionally emit a warning for unused template args

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 05:37:07 PDT 2021


c-rhodes created this revision.
c-rhodes added reviewers: Paul-C-Anagnostopoulos, RKSimon, dblaikie, lattner, sdesmalen.
Herald added a subscriber: hiraditya.
c-rhodes requested review of this revision.
Herald added a project: LLVM.

Add an off by default flag '--warn-on-unused-template-args' to TableGen
that when specified emits a warning on unused template arguments in
classes and multiclasses, for example:

  multiclass Foo<int x> {
    def bar;
  }
  
  $ llvm-tblgen --warn-on-unused-template-args foo.td
  
  foo.td:1:20: warning: unused template argument: Foo::x
  multiclass Foo<int x> {
                     ^


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109359

Files:
  llvm/include/llvm/TableGen/Record.h
  llvm/lib/TableGen/Main.cpp
  llvm/lib/TableGen/Record.cpp
  llvm/lib/TableGen/TGParser.cpp
  llvm/lib/TableGen/TGParser.h
  llvm/test/TableGen/warn-unused-template-arg.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109359.371045.patch
Type: text/x-patch
Size: 5420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210907/e54a6750/attachment.bin>


More information about the llvm-commits mailing list