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 mappings. 16class DiagMapping; 17def MAP_IGNORE : DiagMapping; 18def MAP_WARNING : DiagMapping; 19def MAP_ERROR : DiagMapping; 20def MAP_FATAL : DiagMapping; 21 22// Define the diagnostic classes. 23class DiagClass; 24def CLASS_NOTE : DiagClass; 25def CLASS_WARNING : DiagClass; 26def CLASS_EXTENSION : DiagClass; 27def CLASS_ERROR : DiagClass; 28 29// Responses to a diagnostic in a SFINAE context. 30class SFINAEResponse; 31def SFINAE_SubstitutionFailure : SFINAEResponse; 32def SFINAE_Suppress : SFINAEResponse; 33def SFINAE_Report : SFINAEResponse; 34def SFINAE_AccessControl : SFINAEResponse; 35 36// Diagnostic Categories. These can be applied to groups or individual 37// diagnostics to specify a category. 38class DiagCategory<string Name> { 39 string CategoryName = Name; 40} 41 42// Diagnostic Groups. 43class DiagGroup<string Name, list<DiagGroup> subgroups = []> { 44 string GroupName = Name; 45 list<DiagGroup> SubGroups = subgroups; 46 string CategoryName = ""; 47} 48class InGroup<DiagGroup G> { DiagGroup Group = G; } 49//class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; } 50 51 52// This defines all of the named diagnostic categories. 53include "DiagnosticCategories.td" 54 55// This defines all of the named diagnostic groups. 56include "DiagnosticGroups.td" 57 58 59// All diagnostics emitted by the compiler are an indirect subclass of this. 60class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> { 61 /// Component is specified by the file with a big let directive. 62 string Component = ?; 63 string Text = text; 64 DiagClass Class = DC; 65 SFINAEResponse SFINAE = SFINAE_Suppress; 66 bit AccessControl = 0; 67 bit WarningNoWerror = 0; 68 bit WarningShowInSystemHeader = 0; 69 DiagMapping DefaultMapping = defaultmapping; 70 DiagGroup Group; 71 string CategoryName = ""; 72} 73 74class SFINAEFailure { 75 SFINAEResponse SFINAE = SFINAE_SubstitutionFailure; 76} 77class NoSFINAE { 78 SFINAEResponse SFINAE = SFINAE_Report; 79} 80class AccessControl { 81 SFINAEResponse SFINAE = SFINAE_AccessControl; 82} 83 84// FIXME: ExtWarn and Extension should also be SFINAEFailure by default. 85class Error<string str> : Diagnostic<str, CLASS_ERROR, MAP_ERROR>, SFINAEFailure; 86class Warning<string str> : Diagnostic<str, CLASS_WARNING, MAP_WARNING>; 87class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>; 88class ExtWarn<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>; 89class Note<string str> : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>; 90 91 92class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; } 93class DefaultWarn { DiagMapping DefaultMapping = MAP_WARNING; } 94class DefaultError { DiagMapping DefaultMapping = MAP_ERROR; } 95class DefaultFatal { DiagMapping DefaultMapping = MAP_FATAL; } 96class DefaultWarnNoWerror { 97 bit WarningNoWerror = 1; 98} 99class DefaultWarnShowInSystemHeader { 100 bit WarningShowInSystemHeader = 1; 101} 102 103// Definitions for Diagnostics. 104include "DiagnosticASTKinds.td" 105include "DiagnosticAnalysisKinds.td" 106include "DiagnosticCommentKinds.td" 107include "DiagnosticCommonKinds.td" 108include "DiagnosticDriverKinds.td" 109include "DiagnosticFrontendKinds.td" 110include "DiagnosticLexKinds.td" 111include "DiagnosticParseKinds.td" 112include "DiagnosticSemaKinds.td" 113include "DiagnosticSerializationKinds.td" 114 115