1//===--- Diagnostic.td - C Language Family Diagnostic Handling ------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines the TableGen core definitions for the diagnostics 11// and diagnostic control. 12// 13//===----------------------------------------------------------------------===// 14 15// Define the diagnostic severities. 16class Severity<string N> { 17 string Name = N; 18} 19def SEV_Ignored : Severity<"Ignored">; 20def SEV_Remark : Severity<"Remark">; 21def SEV_Warning : Severity<"Warning">; 22def SEV_Error : Severity<"Error">; 23def SEV_Fatal : Severity<"Fatal">; 24 25// Define the diagnostic classes. 26class DiagClass; 27def CLASS_NOTE : DiagClass; 28def CLASS_REMARK : DiagClass; 29def CLASS_WARNING : DiagClass; 30def CLASS_EXTENSION : DiagClass; 31def CLASS_ERROR : DiagClass; 32 33// Responses to a diagnostic in a SFINAE context. 34class SFINAEResponse; 35def SFINAE_SubstitutionFailure : SFINAEResponse; 36def SFINAE_Suppress : SFINAEResponse; 37def SFINAE_Report : SFINAEResponse; 38def SFINAE_AccessControl : SFINAEResponse; 39 40// Diagnostic Categories. These can be applied to groups or individual 41// diagnostics to specify a category. 42class DiagCategory<string Name> { 43 string CategoryName = Name; 44} 45 46// Diagnostic Groups. 47class DiagGroup<string Name, list<DiagGroup> subgroups = []> { 48 string GroupName = Name; 49 list<DiagGroup> SubGroups = subgroups; 50 string CategoryName = ""; 51} 52class InGroup<DiagGroup G> { DiagGroup Group = G; } 53//class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; } 54 55 56// This defines all of the named diagnostic categories. 57include "DiagnosticCategories.td" 58 59// This defines all of the named diagnostic groups. 60include "DiagnosticGroups.td" 61 62 63// All diagnostics emitted by the compiler are an indirect subclass of this. 64class Diagnostic<string text, DiagClass DC, Severity defaultmapping> { 65 /// Component is specified by the file with a big let directive. 66 string Component = ?; 67 string Text = text; 68 DiagClass Class = DC; 69 SFINAEResponse SFINAE = SFINAE_Suppress; 70 bit AccessControl = 0; 71 bit WarningNoWerror = 0; 72 bit ShowInSystemHeader = 0; 73 Severity DefaultSeverity = defaultmapping; 74 DiagGroup Group; 75 string CategoryName = ""; 76} 77 78class SFINAEFailure { 79 SFINAEResponse SFINAE = SFINAE_SubstitutionFailure; 80} 81class NoSFINAE { 82 SFINAEResponse SFINAE = SFINAE_Report; 83} 84class AccessControl { 85 SFINAEResponse SFINAE = SFINAE_AccessControl; 86} 87 88class ShowInSystemHeader { 89 bit ShowInSystemHeader = 1; 90} 91 92class SuppressInSystemHeader { 93 bit ShowInSystemHeader = 0; 94} 95 96// FIXME: ExtWarn and Extension should also be SFINAEFailure by default. 97class Error<string str> : Diagnostic<str, CLASS_ERROR, SEV_Error>, SFINAEFailure { 98 bit ShowInSystemHeader = 1; 99} 100class Warning<string str> : Diagnostic<str, CLASS_WARNING, SEV_Warning>; 101class Remark<string str> : Diagnostic<str, CLASS_REMARK, SEV_Ignored>; 102class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, SEV_Ignored>; 103class ExtWarn<string str> : Diagnostic<str, CLASS_EXTENSION, SEV_Warning>; 104class Note<string str> : Diagnostic<str, CLASS_NOTE, SEV_Fatal/*ignored*/>; 105 106 107class DefaultIgnore { Severity DefaultSeverity = SEV_Ignored; } 108class DefaultWarn { Severity DefaultSeverity = SEV_Warning; } 109class DefaultError { Severity DefaultSeverity = SEV_Error; } 110class DefaultFatal { Severity DefaultSeverity = SEV_Fatal; } 111class DefaultWarnNoWerror { 112 bit WarningNoWerror = 1; 113} 114class DefaultRemark { Severity DefaultSeverity = SEV_Remark; } 115 116// Definitions for Diagnostics. 117include "DiagnosticASTKinds.td" 118include "DiagnosticAnalysisKinds.td" 119include "DiagnosticCommentKinds.td" 120include "DiagnosticCommonKinds.td" 121include "DiagnosticDriverKinds.td" 122include "DiagnosticFrontendKinds.td" 123include "DiagnosticLexKinds.td" 124include "DiagnosticParseKinds.td" 125include "DiagnosticSemaKinds.td" 126include "DiagnosticSerializationKinds.td" 127 128