[cfe-commits] [PATCH] Warn when an anonymous warning group is used more than once

Jordan Rose jordan_rose at apple.com
Mon Jan 7 18:59:38 PST 2013


Hi, everyone. One thing that's bothered me about our diagnostic TableGen files is the anonymous use of warning groups:

def warn_foo : Warning<"foo is bad">, InGroup<DiagGroup<"foo">>;
def warn_foo_cxx : Warning<"foo is even worse in C++">, InGroup<DiagGroup<"foo">>;

If we ever want to put the warning groups in a hierarchy, or change the name, there's a big chance we'll miss one.

So, I wrote a new warning for clang-tblgen, which even has a fixit if the group already has a name:

warning: group 'foo' is referred to anonymously
def warn_foo : Warning<"foo is bad">, InGroup<DiagGroup<"foo">>;
                                      ~~~~~~~~^~~~~~~~~~~~~~~~~
                                      InGroup<Foo>

And then fixed all the warnings, with the intent that we make this a new style requirement going forwards: groups that cover more than one diagnostic must be named.

This depends on the changes being discussed in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130107/161252.html, but what do people think of this?

Thanks,
Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130107/0dae1e50/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Warn-if-an-anonymous-DiagGroup-is-referenced-multipl.patch
Type: application/octet-stream
Size: 7945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130107/0dae1e50/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130107/0dae1e50/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Diagnostics-name-all-implicit-groups-used-more-than-.patch
Type: application/octet-stream
Size: 24962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130107/0dae1e50/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130107/0dae1e50/attachment-0002.html>


More information about the cfe-commits mailing list