[cfe-dev] Warning options table

Ted Kremenek kremenek at apple.com
Fri Feb 27 15:10:26 PST 2009


On Feb 27, 2009, at 2:50 PM, Sebastian Redl wrote:

> That sounds very good. My only concern with this approach is that it
> makes it difficult to have several overlapping hierarchies. That is,
> aside from the main hierarchy (which will probably be used for the
> Clang-internal component separation, but is of little interest to the
> user), all other groups are basically enumerations of single warnings
> (although declared the other way around). In other words, I can't  
> make a
> whole group part of another group.

Sure you can.  Just do subclassing.  The "Group1" fields are only  
necessary for groups that aren't hierarchical.  For all other groups  
you can just query if a definition inherits from SemaWarning, etc.   
For example, we could have a another warning group that subclasses  
SemaWarning.  From my understanding of TableGen, the backend has  
complete access to the tablegen type system and its hierarchy.

> Though I suppose I can do that simply with name equality, i.e.
>
> def Warning1 : SemaWarning<"foo", "bar"> {
>  let Group1 = 1;
> }
>
> def Group1 : WarningGroup<"group1", "blabla"> {
>  let Group2 = 1;
> }

I'm not certain what you mean.  I don't think you need WarninGroup at  
all, unless WarningGroup subclasses SemaWarning, etc.



More information about the cfe-dev mailing list