/// \param Loc The source location we are interested in finding out the
/// diagnostic state. Can be null in order to query the latest state.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const {
- return Diags->getDiagnosticLevel(DiagID, Loc, *this) ==
- DiagnosticIDs::Ignored;
+ return Diags->getDiagnosticSeverity(DiagID, Loc, *this) ==
+ diag::Severity::Ignored;
}
/// \brief Based on the way the client configured the DiagnosticsEngine
SFINAEResponse SFINAE = SFINAE_Suppress;
bit AccessControl = 0;
bit WarningNoWerror = 0;
- bit WarningShowInSystemHeader = 0;
+ bit ShowInSystemHeader = 0;
Severity DefaultSeverity = defaultmapping;
DiagGroup Group;
string CategoryName = "";
SFINAEResponse SFINAE = SFINAE_AccessControl;
}
+class ShowInSystemHeader {
+ bit ShowInSystemHeader = 1;
+}
+
// FIXME: ExtWarn and Extension should also be SFINAEFailure by default.
-class Error<string str> : Diagnostic<str, CLASS_ERROR, SEV_Error>, SFINAEFailure;
+class Error<string str> : Diagnostic<str, CLASS_ERROR, SEV_Error>, SFINAEFailure {
+ bit ShowInSystemHeader = 1;
+}
class Warning<string str> : Diagnostic<str, CLASS_WARNING, SEV_Warning>;
class Remark<string str> : Diagnostic<str, CLASS_REMARK, SEV_Ignored>;
class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, SEV_Ignored>;
class DefaultWarnNoWerror {
bit WarningNoWerror = 1;
}
-class DefaultWarnShowInSystemHeader {
- bit WarningShowInSystemHeader = 1;
-}
class DefaultRemark { Severity DefaultSeverity = SEV_Remark; }
// Definitions for Diagnostics.
//
//===----------------------------------------------------------------------===//
-class BackendInfo : CatBackend, DefaultWarnShowInSystemHeader;
+class BackendInfo : CatBackend, ShowInSystemHeader;
let Component = "Frontend" in {
getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
const DiagnosticsEngine &Diag) const LLVM_READONLY;
- /// \brief An internal implementation helper used when \p DiagClass is
- /// already known.
diag::Severity
- getDiagnosticSeverity(unsigned DiagID, unsigned DiagClass, SourceLocation Loc,
+ getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
const DiagnosticsEngine &Diag) const LLVM_READONLY;
/// \brief Used to report a diagnostic that is finally fully formed.
let CategoryName = "User Defined Issues" in {
def pp_hash_warning : Warning<"%0">,
- InGroup<PoundWarning>, DefaultWarnShowInSystemHeader;
+ InGroup<PoundWarning>, ShowInSystemHeader;
def err_pp_hash_error : Error<"%0">;
}
def warn_pp_date_time : Warning<
"expansion of date or time macro is not reproducible">,
- DefaultWarnShowInSystemHeader, DefaultIgnore, InGroup<DiagGroup<"date-time">>;
+ ShowInSystemHeader, DefaultIgnore, InGroup<DiagGroup<"date-time">>;
// Module map parsing
def err_mmap_unknown_token : Error<"skipping stray token">;
unsigned DiagClass = getBuiltinDiagClass(DiagID);
if (DiagClass == CLASS_NOTE) return DiagnosticIDs::Note;
- return toLevel(getDiagnosticSeverity(DiagID, DiagClass, Loc, Diag));
+ return toLevel(getDiagnosticSeverity(DiagID, Loc, Diag));
}
/// \brief Based on the way the client configured the Diagnostic
/// \param Loc The source location we are interested in finding out the
/// diagnostic state. Can be null in order to query the latest state.
diag::Severity
-DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, unsigned DiagClass,
- SourceLocation Loc,
+DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
const DiagnosticsEngine &Diag) const {
- assert(DiagClass != CLASS_NOTE);
+ assert(getBuiltinDiagClass(DiagID) != CLASS_NOTE);
// Specific non-error diagnostics may be mapped to various levels from ignored
// to error. Errors can only be mapped to fatal.
// Diagnostics of class REMARK are either printed as remarks or in case they
// have been added to -Werror they are printed as errors.
- if (DiagClass == CLASS_REMARK && Result == diag::Severity::Warning)
+ // FIXME: Disregarding user-requested remark mappings like this is bogus.
+ if (Result == diag::Severity::Warning &&
+ getBuiltinDiagClass(DiagID) == CLASS_REMARK)
Result = diag::Severity::Remark;
// Ignore -pedantic diagnostics inside __extension__ blocks.
// If we are in a system header, we ignore it. We look at the diagnostic class
// because we also want to ignore extensions and warnings in -Werror and
// -pedantic-errors modes, which *map* warnings/extensions to errors.
- if (Result >= diag::Severity::Warning && DiagClass != CLASS_ERROR &&
- !ShowInSystemHeader && Diag.SuppressSystemWarnings && Loc.isValid() &&
+ if (Diag.SuppressSystemWarnings && !ShowInSystemHeader && Loc.isValid() &&
Diag.getSourceManager().isInSystemHeader(
Diag.getSourceManager().getExpansionLoc(Loc)))
return diag::Severity::Ignored;
else
OS << ", false";
- // Default warning show in system header bit.
- if (R.getValueAsBit("WarningShowInSystemHeader"))
+ if (R.getValueAsBit("ShowInSystemHeader"))
OS << ", true";
else
OS << ", false";