• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:fatal +full:- +full:warnings

1 //===--- DiagnosticIDs.cpp - Diagnostic IDs Handling ----------------------===//
8 //===----------------------------------------------------------------------===//
10 // This file implements the Diagnostic IDs-related interfaces.
12 //===----------------------------------------------------------------------===//
24 //===----------------------------------------------------------------------===//
26 //===----------------------------------------------------------------------===//
96 /// GetDiagInfo - Return the StaticDiagInfoRec entry for the specified DiagID,
125 unsigned ID = DiagID - DIAG_START_COMMON - 1; in GetDiagInfo()
128 Offset += NUM_BUILTIN_##PREV##_DIAGNOSTICS - DIAG_START_##PREV - 1; \ in GetDiagInfo()
129 ID -= DIAG_START_##NAME - DIAG_START_##PREV; \ in GetDiagInfo()
152 if (Found->DiagID != DiagID) in GetDiagInfo()
159 diag::Severity::Fatal, /*IsUser=*/false, /*IsPragma=*/false); in GetDefaultDiagMapping()
162 Info.setSeverity((diag::Severity)StaticInfo->DefaultSeverity); in GetDefaultDiagMapping()
164 if (StaticInfo->WarnNoWerror) { in GetDefaultDiagMapping()
166 "Unexpected mapping with no-Werror bit!"); in GetDefaultDiagMapping()
174 /// getCategoryNumberForDiag - Return the category number that a specified
178 return Info->Category; in getCategoryNumberForDiag()
204 Result.first->second = GetDefaultDiagMapping(Diag); in getOrAddMapping()
206 return Result.first->second; in getOrAddMapping()
217 /// getNumberOfCategories - Return the number of categories
219 return llvm::array_lengthof(CategoryNameTable) - 1; in getNumberOfCategories()
222 /// getCategoryNameFromID - Given a category ID, return the name of the
236 return static_cast<DiagnosticIDs::SFINAEResponse>(Info->SFINAE); in getDiagnosticSFINAEResponse()
240 /// getBuiltinDiagClass - Return the class field of the diagnostic.
244 return Info->Class; in getBuiltinDiagClass()
248 //===----------------------------------------------------------------------===//
250 //===----------------------------------------------------------------------===//
260 /// getDescription - Return the description of the specified custom
263 assert(DiagID - DIAG_UPPER_LIMIT < DiagInfo.size() && in getDescription()
265 return DiagInfo[DiagID-DIAG_UPPER_LIMIT].second; in getDescription()
268 /// getLevel - Return the level of the specified custom diagnostic.
270 assert(DiagID - DIAG_UPPER_LIMIT < DiagInfo.size() && in getLevel()
272 return DiagInfo[DiagID-DIAG_UPPER_LIMIT].first; in getLevel()
280 if (I != DiagIDs.end() && I->first == D) in getOrCreateDiagID()
281 return I->second; in getOrCreateDiagID()
295 //===----------------------------------------------------------------------===//
297 //===----------------------------------------------------------------------===//
305 /// getCustomDiagID - Return an ID for a diagnostic with the specified message
314 return CustomDiagInfo->getOrCreateDiagID(L, FormatString, *this); in getCustomDiagID()
318 /// isBuiltinWarningOrExtension - Return true if the unmapped diagnostic
327 /// \brief Determine whether the given built-in diagnostic ID is a
334 /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic
337 /// which case -pedantic enables it) or treated as a warning/error by default.
357 /// getDescription - Given a diagnostic ID, return a description of the
361 return Info->getDescription(); in getDescription()
363 return CustomDiagInfo->getDescription(DiagID); in getDescription()
376 case diag::Severity::Fatal: in toLevel()
377 return DiagnosticIDs::Fatal; in toLevel()
382 /// getDiagnosticLevel - Based on the way the client configured the
391 return CustomDiagInfo->getLevel(DiagID); in getDiagnosticLevel()
410 // Specific non-error diagnostics may be mapped to various levels from ignored in getDiagnosticSeverity()
411 // to error. Errors can only be mapped to fatal. in getDiagnosticSeverity()
412 diag::Severity Result = diag::Severity::Fatal; in getDiagnosticSeverity()
416 DiagnosticsEngine::DiagState *State = Pos->State; in getDiagnosticSeverity()
419 DiagnosticMapping &Mapping = State->getOrAddMapping((diag::kind)DiagID); in getDiagnosticSeverity()
425 // Upgrade ignored diagnostics if -Weverything is enabled. in getDiagnosticSeverity()
430 // Ignore -pedantic diagnostics inside __extension__ blocks. in getDiagnosticSeverity()
431 // (The diagnostics controlled by -pedantic are the extension diagnostics in getDiagnosticSeverity()
447 // Honor -w, which is lower in priority than pedantic-errors, but higher than in getDiagnosticSeverity()
448 // -Werror. in getDiagnosticSeverity()
452 // If -Werror is enabled, map warnings to errors unless explicitly disabled. in getDiagnosticSeverity()
458 // If -Wfatal-errors is enabled, map errors to fatal unless explicity in getDiagnosticSeverity()
462 Result = diag::Severity::Fatal; in getDiagnosticSeverity()
465 // If explicitly requested, map fatal errors to errors. in getDiagnosticSeverity()
466 if (Result == diag::Severity::Fatal) { in getDiagnosticSeverity()
473 !GetDiagInfo(DiagID) || GetDiagInfo(DiagID)->WarnShowInSystemHeader; in getDiagnosticSeverity()
476 // because we also want to ignore extensions and warnings in -Werror and in getDiagnosticSeverity()
477 // -pedantic-errors modes, which *map* warnings/extensions to errors. in getDiagnosticSeverity()
496 // String is stored with a pascal-style length byte.
511 /// getWarningOptionForDiag - Return the lowest-level warning option that
512 /// enables the specified diagnostic. If there is no -Wfoo flag that controls
516 return OptionTable[Info->getOptionGroupIndex()].getName(); in getWarningOptionForDiag()
527 if (!Group->Members && !Group->SubGroups) in getDiagnosticsInGroup()
533 const int16_t *Member = DiagArrays + Group->Members; in getDiagnosticsInGroup()
534 for (; *Member != -1; ++Member) { in getDiagnosticsInGroup()
535 if (GetDiagInfo(*Member)->getFlavor() == Flavor) { in getDiagnosticsInGroup()
542 const int16_t *SubGroups = DiagSubGroups + Group->SubGroups; in getDiagnosticsInGroup()
543 for (; *SubGroups != (int16_t)-1; ++SubGroups) in getDiagnosticsInGroup()
558 if (Found == std::end(OptionTable) || Found->getName() != Group) in getDiagnosticsInGroup()
602 /// ProcessDiag - This is the method used to report a diagnostic that is
614 // Update counts for DiagnosticErrorTrap even if a fatal error occurred in ProcessDiag()
626 // Record that a fatal error occurred only when we see a second in ProcessDiag()
627 // non-note diagnostic. This allows notes to be attached to the in ProcessDiag()
628 // fatal error, but suppresses any diagnostics that follow those in ProcessDiag()
630 if (Diag.LastDiagLevel == DiagnosticIDs::Fatal) in ProcessDiag()
636 // If a fatal error has already been emitted, silence all subsequent in ProcessDiag()
640 Diag.Client->IncludeInDiagnosticCounts()) { in ProcessDiag()
658 // Warnings which have been upgraded to errors do not prevent compilation. in ProcessDiag()
663 if (Diag.Client->IncludeInDiagnosticCounts()) { in ProcessDiag()
667 // If we've emitted a lot of errors, emit a fatal error instead of it to in ProcessDiag()
685 Diag.Client->HandleDiagnostic((DiagnosticsEngine::Level)DiagLevel, Info); in EmitDiag()
686 if (Diag.Client->IncludeInDiagnosticCounts()) { in EmitDiag()
698 return CustomDiagInfo->getLevel(DiagID) >= DiagnosticIDs::Error; in isUnrecoverable()