[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 07:18:09 PDT 2021


c-rhodes added a comment.

In D109359#2986672 <https://reviews.llvm.org/D109359#2986672>, @Paul-C-Anagnostopoulos wrote:

> (I've been scarce due to summer holidays and, sadly, real work.)
>
> This is a great feature. Do we also need to add an 'unused' declaration that acknowledges the non-use of a template argument and suppresses the warning?

I'm not really sure what an unused declaration would look like in TableGen, in C I think prefixing unused args with `(void)` is the usual way of suppressing these kind of errors. One existing way to suppress the warning could be:

  class Foo<int x> {
    int x = x;
  }

but that's not particularly pretty.

> Are there legitimate cases where an argument is passed but not used?

Good question, I haven't looked at all the warnings but I've not observed this for AArch64.

> I think the test should include a couple of cases where the argument is used, to be sure that no warning is produced.

Good point I'll add a test for that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109359



More information about the llvm-commits mailing list