Home | History | Annotate | Download | only in TableGen
      1 // Define the diagnostic mappings.
      2 class DiagMapping;
      3 def MAP_IGNORE  : DiagMapping;
      4 def MAP_WARNING : DiagMapping;
      5 def MAP_ERROR   : DiagMapping;
      6 def MAP_FATAL   : DiagMapping;
      7 
      8 // Define the diagnostic classes.
      9 class DiagClass;
     10 def CLASS_NOTE      : DiagClass;
     11 def CLASS_WARNING   : DiagClass;
     12 def CLASS_EXTENSION : DiagClass;
     13 def CLASS_ERROR     : DiagClass;
     14 
     15 class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
     16   string GroupName = Name;
     17   list<DiagGroup> SubGroups = subgroups;
     18   string CategoryName = "";
     19 }
     20 class InGroup<DiagGroup G> { DiagGroup Group = G; }
     21 
     22 // All diagnostics emitted by the compiler are an indirect subclass of this.
     23 class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
     24   string      Text = text;
     25   DiagClass   Class = DC;
     26   DiagMapping DefaultMapping = defaultmapping;
     27   DiagGroup   Group;
     28   string      CategoryName = "";
     29 }
     30 
     31 class Error<string str>     : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;
     32 class Warning<string str>   : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
     33 class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
     34 class ExtWarn<string str>   : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
     35 class Note<string str>      : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;
     36