|
clang 24.0.0git
|
Concrete class used by the front-end to report problems and issues. More...
#include "clang/Basic/Diagnostic.h"
Public Types | |
| enum | Level { Ignored = DiagnosticIDs::Ignored , Note = DiagnosticIDs::Note , Remark = DiagnosticIDs::Remark , Warning = DiagnosticIDs::Warning , Error = DiagnosticIDs::Error , Fatal = DiagnosticIDs::Fatal } |
| The level of the diagnostic, after it has been through mapping. More... | |
| enum | ArgumentKind { ak_std_string , ak_c_string , ak_sint , ak_uint , ak_tokenkind , ak_identifierinfo , ak_addrspace , ak_qual , ak_qualtype , ak_declarationname , ak_nameddecl , ak_nestednamespec , ak_declcontext , ak_qualtype_pair , ak_attr , ak_expr , ak_attr_info } |
| using | ArgumentValue = std::pair<ArgumentKind, intptr_t> |
| Represents on argument value, which is a union discriminated by ArgumentKind, with a value. | |
| using | diag_mapping_range = llvm::iterator_range<DiagState::const_iterator> |
Public Member Functions | |
| const void * | getDiagStateKeyForLoc (SourceLocation Loc) const |
Returns a cache key representing the diagnostic state at Loc. | |
| DiagStateSystemClass | getDiagStateSystemClassForLoc (SourceLocation Loc) const |
Returns whether Loc is in a system header and/or a system macro. | |
| bool | hasDiagSuppressionMapping () const |
| True if an active diagnostic suppression mapping makes severity dependent on the file path. | |
| DiagnosticsEngine (IntrusiveRefCntPtr< DiagnosticIDs > Diags, DiagnosticOptions &DiagOpts, DiagnosticConsumer *client=nullptr, bool ShouldOwnClient=true) | |
| DiagnosticsEngine (const DiagnosticsEngine &)=delete | |
| DiagnosticsEngine & | operator= (const DiagnosticsEngine &)=delete |
| ~DiagnosticsEngine () | |
| LLVM_DUMP_METHOD void | dump () const |
| LLVM_DUMP_METHOD void | dump (StringRef DiagName) const |
| const IntrusiveRefCntPtr< DiagnosticIDs > & | getDiagnosticIDs () const |
| DiagnosticOptions & | getDiagnosticOptions () const |
| Retrieve the diagnostic options. | |
| diag_mapping_range | getDiagnosticMappings () const |
| Get the current set of diagnostic mappings. | |
| DiagnosticConsumer * | getClient () |
| const DiagnosticConsumer * | getClient () const |
| bool | ownsClient () const |
Determine whether this DiagnosticsEngine object own its client. | |
| std::unique_ptr< DiagnosticConsumer > | takeClient () |
| Return the current diagnostic client along with ownership of that client. | |
| bool | hasSourceManager () const |
| SourceManager & | getSourceManager () const |
| void | setSourceManager (SourceManager *SrcMgr) |
| void | pushMappings (SourceLocation Loc) |
| Copies the current DiagMappings and pushes the new copy onto the top of the stack. | |
| bool | popMappings (SourceLocation Loc) |
| Pops the current DiagMappings off the top of the stack, causing the new top of the stack to be the active mappings. | |
| void | setClient (DiagnosticConsumer *client, bool ShouldOwnClient=true) |
| Set the diagnostic client associated with this diagnostic object. | |
| void | setErrorLimit (unsigned Limit) |
| Specify a limit for the number of errors we should emit before giving up. | |
| void | setTemplateBacktraceLimit (unsigned Limit) |
| Specify the maximum number of template instantiation notes to emit along with a given diagnostic. | |
| unsigned | getTemplateBacktraceLimit () const |
| Retrieve the maximum number of template instantiation notes to emit along with a given diagnostic. | |
| void | setConstexprBacktraceLimit (unsigned Limit) |
| Specify the maximum number of constexpr evaluation notes to emit along with a given diagnostic. | |
| unsigned | getConstexprBacktraceLimit () const |
| Retrieve the maximum number of constexpr evaluation notes to emit along with a given diagnostic. | |
| void | setIgnoreAllWarnings (bool Val) |
| When set to true, any unmapped warnings are ignored. | |
| bool | getIgnoreAllWarnings () const |
| void | setEnableAllWarnings (bool Val) |
| When set to true, any unmapped ignored warnings are no longer ignored. | |
| bool | getEnableAllWarnings () const |
| void | setWarningsAsErrors (bool Val) |
| When set to true, any warnings reported are issued as errors. | |
| bool | getWarningsAsErrors () const |
| void | setErrorsAsFatal (bool Val) |
| When set to true, any error reported is made a fatal error. | |
| bool | getErrorsAsFatal () const |
| void | setFatalsAsError (bool Val) |
| When set to true, any fatal error reported is made an error. | |
| bool | getFatalsAsError () const |
| void | setSuppressSystemWarnings (bool Val) |
| When set to true mask warnings that come from system headers. | |
| bool | getSuppressSystemWarnings () const |
| void | setSuppressAllDiagnostics (bool Val) |
| Suppress all diagnostics, to silence the front end when we know that we don't want any more diagnostics to be passed along to the client. | |
| bool | getSuppressAllDiagnostics () const |
| void | setForceSystemWarnings (bool Val) |
| bool | getForceSystemWarnings () const |
| void | setElideType (bool Val) |
| Set type eliding, to skip outputting same types occurring in template types. | |
| bool | getElideType () |
| void | setPrintTemplateTree (bool Val) |
| Set tree printing, to outputting the template difference in a tree format. | |
| bool | getPrintTemplateTree () |
| void | setShowColors (bool Val) |
| Set color printing, so the type diffing will inject color markers into the output. | |
| bool | getShowColors () |
| void | setShowOverloads (OverloadsShown Val) |
| Specify which overload candidates to show when overload resolution fails. | |
| OverloadsShown | getShowOverloads () const |
| unsigned | getNumOverloadCandidatesToShow () const |
| When a call or operator fails, print out up to this many candidate overloads as suggestions. | |
| void | overloadCandidatesShown (unsigned N) |
| Call this after showing N overload candidates. | |
| void | setLastDiagnosticIgnored (bool IsIgnored) |
| Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed, or restore a prior ignoring state after ignoring some diagnostics and their notes, possibly in the middle of another diagnostic. | |
| bool | isLastDiagnosticIgnored () const |
| Determine whether the previous diagnostic was ignored. | |
| void | setExtensionHandlingBehavior (diag::Severity H) |
| Controls whether otherwise-unmapped extension diagnostics are mapped onto ignore/warning/error. | |
| diag::Severity | getExtensionHandlingBehavior () const |
| void | IncrementAllExtensionsSilenced () |
| Counter bumped when an extension block is/ encountered. | |
| void | DecrementAllExtensionsSilenced () |
| bool | hasAllExtensionsSilenced () |
| void | setSeverity (diag::kind Diag, diag::Severity Map, SourceLocation Loc) |
| This allows the client to specify that certain warnings are ignored. | |
| bool | setSeverityForGroup (diag::Flavor Flavor, StringRef Group, diag::Severity Map, SourceLocation Loc=SourceLocation()) |
| Change an entire diagnostic group (e.g. | |
| bool | setSeverityForGroup (diag::Flavor Flavor, diag::Group Group, diag::Severity Map, SourceLocation Loc=SourceLocation()) |
| bool | setDiagnosticGroupWarningAsError (StringRef Group, bool Enabled) |
| Set the warning-as-error flag for the given diagnostic group. | |
| bool | setDiagnosticGroupErrorAsFatal (StringRef Group, bool Enabled) |
| Set the error-as-fatal flag for the given diagnostic group. | |
| void | setSeverityForAll (diag::Flavor Flavor, diag::Severity Map, SourceLocation Loc=SourceLocation()) |
| Add the specified mapping to all diagnostics of the specified flavor. | |
| bool | hasErrorOccurred () const |
| bool | hasUncompilableErrorOccurred () const |
| Errors that actually prevent compilation, not those that are upgraded from a warning by -Werror. | |
| bool | hasFatalErrorOccurred () const |
| bool | hasUnrecoverableErrorOccurred () const |
| Determine whether any kind of unrecoverable error has occurred. | |
| unsigned | getNumErrors () const |
| unsigned | getNumWarnings () const |
| void | setNumWarnings (unsigned NumWarnings) |
| template<unsigned N> | |
| unsigned | getCustomDiagID (Level L, const char(&FormatString)[N]) |
| Return an ID for a diagnostic with the specified format string and level. | |
| void | ConvertArgToString (ArgumentKind Kind, intptr_t Val, StringRef Modifier, StringRef Argument, ArrayRef< ArgumentValue > PrevArgs, SmallVectorImpl< char > &Output, ArrayRef< intptr_t > QualTypeVals) const |
| Converts a diagnostic argument (as an intptr_t) into the string that represents it. | |
| void | SetArgToStringFn (ArgToStringFnTy Fn, void *Cookie) |
| void | notePriorDiagnosticFrom (const DiagnosticsEngine &Other) |
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a note to that diagnostic. | |
| void | Reset (bool soft=false) |
| Reset the state of the diagnostic object to its initial configuration. | |
| void | ResetPragmas () |
| We keep a cache of FileIDs for diagnostics mapped by pragmas. | |
| bool | isIgnored (unsigned DiagID, SourceLocation Loc) const |
| Determine whether the diagnostic is known to be ignored. | |
| bool | areAllIgnored (StringRef Group, SourceLocation Loc) const |
| Level | getDiagnosticLevel (unsigned DiagID, SourceLocation Loc) const |
| Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnostic ID into a Level, consumable by the DiagnosticConsumer. | |
| void | setDiagSuppressionMapping (llvm::MemoryBuffer &Input) |
| Diagnostic suppression mappings can be used to suppress specific diagnostics in specific files. | |
| bool | isSuppressedViaMapping (diag::kind DiagId, SourceLocation DiagLoc) const |
| DiagnosticBuilder | Report (SourceLocation Loc, unsigned DiagID) |
| Issue the message to the client. | |
| DiagnosticBuilder | Report (unsigned DiagID) |
| void | Report (const StoredDiagnostic &storedDiag) |
Friends | |
| class | Diagnostic |
| class | DiagnosticBuilder |
| class | DiagnosticErrorTrap |
| class | DiagnosticIDs |
| class | PartialDiagnostic |
| void | DiagnosticsTestHelper (DiagnosticsEngine &) |
Diagnostic Emission | |
| class | ASTReader |
| class | ASTWriter |
| class | Sema |
| bool | EmitDiagnostic (const DiagnosticBuilder &DB, bool Force=false) |
| Emit the diagnostic. | |
Concrete class used by the front-end to report problems and issues.
This massages the diagnostics (e.g. handling things like "report warnings as errors" and passes them off to the DiagnosticConsumer for reporting to the user. DiagnosticsEngine is tied to one translation unit and one SourceManager.
Definition at line 241 of file Diagnostic.h.
| using clang::DiagnosticsEngine::ArgumentValue = std::pair<ArgumentKind, intptr_t> |
Represents on argument value, which is a union discriminated by ArgumentKind, with a value.
Definition at line 310 of file Diagnostic.h.
| using clang::DiagnosticsEngine::diag_mapping_range = llvm::iterator_range<DiagState::const_iterator> |
Definition at line 637 of file Diagnostic.h.
| Enumerator | |
|---|---|
| ak_std_string | std::string |
| ak_c_string | const char * |
| ak_sint | int |
| ak_uint | unsigned |
| ak_tokenkind | enum TokenKind : unsigned |
| ak_identifierinfo | |
| ak_addrspace | address space |
| ak_qual | |
| ak_qualtype | |
| ak_declarationname | |
| ak_nameddecl | NamedDecl *. |
| ak_nestednamespec | |
| ak_declcontext | DeclContext *. |
| ak_qualtype_pair | pair<QualType, QualType> |
| ak_attr | Attr *. |
| ak_expr | Expr *. |
| ak_attr_info | |
Definition at line 255 of file Diagnostic.h.
The level of the diagnostic, after it has been through mapping.
| Enumerator | |
|---|---|
| Ignored | |
| Note | |
| Remark | |
| Warning | |
| Error | |
| Fatal | |
Definition at line 246 of file Diagnostic.h.
|
explicit |
Definition at line 78 of file Diagnostic.cpp.
References DummyArgToStringFn(), clang::Reset, and setClient().
Referenced by DiagnosticsEngine(), DiagnosticsTestHelper, notePriorDiagnosticFrom(), and operator=().
|
delete |
References DiagnosticsEngine().
| DiagnosticsEngine::~DiagnosticsEngine | ( | ) |
Definition at line 89 of file Diagnostic.cpp.
References setClient().
|
inline |
Definition at line 997 of file Diagnostic.h.
References clang::diag::Ignored, and clang::diag::WarningOrError.
|
inline |
Converts a diagnostic argument (as an intptr_t) into the string that represents it.
Definition at line 953 of file Diagnostic.h.
Referenced by clang::Diagnostic::FormatDiagnostic().
|
inline |
Definition at line 860 of file Diagnostic.h.
| void DiagnosticsEngine::dump | ( | ) | const |
Definition at line 95 of file Diagnostic.cpp.
| void DiagnosticsEngine::dump | ( | StringRef | DiagName | ) | const |
Definition at line 97 of file Diagnostic.cpp.
|
protected |
Emit the diagnostic.
| Force | Emit the diagnostic regardless of suppression settings. |
Definition at line 732 of file Diagnostic.cpp.
References Diagnostic, DiagnosticBuilder, getClient(), getDiagnosticLevel(), clang::Diagnostic::getID(), clang::Diagnostic::getLocation(), Ignored, and clang::sema::Report.
|
inline |
Definition at line 645 of file Diagnostic.h.
Referenced by EmitDiagnostic(), clang::ASTUnit::enableSourceFileDiagnostics(), clang::ASTMergeAction::ExecuteAction(), clang::CompilerInstance::ExecuteAction(), clang::CompilerInstance::printDiagnosticStats(), SetUpDiagnosticLog(), SetupSerializedDiagnostics(), and clang::ASTUnit::~ASTUnit().
|
inline |
Definition at line 646 of file Diagnostic.h.
|
inline |
Retrieve the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
Definition at line 714 of file Diagnostic.h.
|
inline |
Return an ID for a diagnostic with the specified format string and level.
If this is the first request for this diagnostic, it is registered and created, otherwise the existing ID is returned.
| FormatString | A fixed diagnostic format string that will be hashed and mapped to a unique DiagID. |
Definition at line 946 of file Diagnostic.h.
Referenced by addPGOAndCoverageFlags(), clang::CodeGen::CodeGenModule::Error(), clang::CIRGen::CIRGenModule::error(), clang::TextDiagnosticBuffer::FlushDiagnostics(), rewriteToNumericBoxedExpression(), and clang::driver::ToolChain::TranslateXarchArgs().
|
inline |
Definition at line 630 of file Diagnostic.h.
Referenced by checkDiagnosticGroupMappings(), clang::SemaBase::Diag(), diagnoseDiagnoseIfAttrsWith(), clang::ASTMergeAction::ExecuteAction(), clang::Diagnostic::FormatDiagnostic(), handleDiagnoseIfAttr(), clang::LogDiagnosticPrinter::HandleDiagnostic(), printDiagnosticOptions(), clang::ProcessWarningOptions(), and clang::PCHValidator::ReadDiagnosticOptions().
|
inline |
Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnostic ID into a Level, consumable by the DiagnosticConsumer.
To preserve invariant assumptions, this function should not be used to influence parse or semantic analysis actions. Instead consider using isIgnored().
| Loc | The source location we are interested in finding out the diagnostic state. Can be null in order to query the latest state. |
Definition at line 1017 of file Diagnostic.h.
Referenced by checkDiagnosticGroupMappings(), EmitDiagnostic(), and clang::CompilerInstance::loadModuleFile().
|
inline |
Get the current set of diagnostic mappings.
Definition at line 640 of file Diagnostic.h.
|
inline |
Retrieve the diagnostic options.
Definition at line 635 of file Diagnostic.h.
Referenced by clang::Sema::ActOnCXXTypeid(), CheckResults(), DetailedErrorString(), EvaluateValue(), ParseDirective(), PrintExpected(), PrintUnexpected(), clang::PCHValidator::ReadDiagnosticOptions(), shouldEmitUnsafeBufferUsageSuggestions(), shouldSuggestUnsafeBufferUsageSuggestions(), and showColorsForStream().
|
inline |
Returns a cache key representing the diagnostic state at Loc.
Definition at line 602 of file Diagnostic.h.
Referenced by clang::sema::AnalysisBasedWarnings::getPolicyInEffectAt().
| DiagStateSystemClass DiagnosticsEngine::getDiagStateSystemClassForLoc | ( | SourceLocation | Loc | ) | const |
Returns whether Loc is in a system header and/or a system macro.
Severity depends on this through DiagnosticIDs::shouldSuppressAsSystemWarning(), so a cache keyed on getDiagStateKeyForLoc() must take it into account as well.
Definition at line 612 of file Diagnostic.cpp.
References clang::Class, clang::SourceManager::getExpansionLoc(), getSourceManager(), clang::SourceManager::isInSystemHeader(), clang::SourceManager::isInSystemMacro(), clang::SystemHeader, and clang::SystemMacro.
Referenced by clang::sema::AnalysisBasedWarnings::getPolicyInEffectAt().
|
inline |
Definition at line 777 of file Diagnostic.h.
|
inline |
Definition at line 735 of file Diagnostic.h.
Referenced by checkDiagnosticMappings().
|
inline |
Definition at line 749 of file Diagnostic.h.
|
inline |
Definition at line 851 of file Diagnostic.h.
Referenced by HasExtension(), and isExtHandlingFromDiagsError().
|
inline |
Definition at line 755 of file Diagnostic.h.
|
inline |
Definition at line 772 of file Diagnostic.h.
|
inline |
Definition at line 724 of file Diagnostic.h.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings(), and shouldSkipAnalysisForDecl().
|
inline |
Definition at line 927 of file Diagnostic.h.
Referenced by clang::ExecuteCompilerInvocation(), FixupInvocation(), ParseAnalyzerArgs(), ParseDependencyOutputArgs(), ParseFileSystemArgs(), ParseFrontendArgs(), ParseHeaderSearchArgs(), ParseMigratorArgs(), ParsePreprocessorArgs(), ParsePreprocessorOutputArgs(), ParseSSAFArgs(), and ParseTargetArgs().
|
inline |
When a call or operator fails, print out up to this many candidate overloads as suggestions.
With Ovl_Best, we set a high limit for the first nontrivial overload set we print, and a lower limit for later sets. This way the user has a chance of diagnosing at least one callsite in their program without having to recompile with -fshow-overloads=all.
Definition at line 803 of file Diagnostic.h.
References getShowOverloads(), clang::Ovl_All, and clang::Ovl_Best.
Referenced by clang::ImplicitConversionSequence::DiagnoseAmbiguousConversion(), clang::OverloadCandidateSet::NoteCandidates(), and noteOverloads().
|
inline |
Definition at line 928 of file Diagnostic.h.
Referenced by RoundTrip().
|
inline |
Definition at line 782 of file Diagnostic.h.
|
inline |
Definition at line 787 of file Diagnostic.h.
Referenced by clang::Preprocessor::Preprocessor().
|
inline |
Definition at line 794 of file Diagnostic.h.
Referenced by getNumOverloadCandidatesToShow(), clang::OverloadCandidateSet::NoteCandidates(), and clang::TemplateSpecCandidateSet::NoteCandidates().
|
inline |
Definition at line 657 of file Diagnostic.h.
Referenced by getDiagStateSystemClassForLoc(), and isSuppressedViaMapping().
|
inline |
Definition at line 769 of file Diagnostic.h.
|
inline |
Definition at line 761 of file Diagnostic.h.
Referenced by checkDiagnosticMappings(), diagnoseSubtractionOnNullPointer(), getNullabilityCompletenessCheckFileID(), and shouldSkipAnalysisForDecl().
|
inline |
Retrieve the maximum number of template instantiation notes to emit along with a given diagnostic.
Definition at line 704 of file Diagnostic.h.
|
inline |
Definition at line 743 of file Diagnostic.h.
Referenced by checkDiagnosticMappings(), and isExtHandlingFromDiagsError().
|
inline |
Definition at line 861 of file Diagnostic.h.
|
inline |
True if an active diagnostic suppression mapping makes severity dependent on the file path.
Definition at line 614 of file Diagnostic.h.
Referenced by clang::sema::AnalysisBasedWarnings::getPolicyInEffectAt().
|
inline |
Definition at line 913 of file Diagnostic.h.
Referenced by clang::dependencies::CompilerInstanceWithContext::computeDependencies(), cir::CIRGenAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::InProcessPrintingASTConsumer::HandleTopLevelDecl(), clang::installapi::InstallAPIVisitor::HandleTranslationUnit(), clang::PCHGenerator::HandleTranslationUnit(), readASTAfterCompileModule(), clang::dependencies::CompilerInstanceWithContext::scanTranslationUnit(), and clang::FrontendAction::shouldEraseOutputFiles().
|
inline |
Definition at line 920 of file Diagnostic.h.
Referenced by emitCallStackNotes().
|
inline |
Definition at line 655 of file Diagnostic.h.
Referenced by isSuppressedViaMapping().
|
inline |
Errors that actually prevent compilation, not those that are upgraded from a warning by -Werror.
Definition at line 917 of file Diagnostic.h.
Referenced by clang::ASTWriter::WriteAST().
|
inline |
Determine whether any kind of unrecoverable error has occurred.
Definition at line 923 of file Diagnostic.h.
|
inline |
Counter bumped when an extension block is/ encountered.
When non-zero, all extension diagnostics are entirely silenced, no matter how they are mapped.
Definition at line 859 of file Diagnostic.h.
|
inline |
Determine whether the diagnostic is known to be ignored.
This can be used to opportunistically avoid expensive checks when it's known for certain that the diagnostic has been suppressed at the specified location Loc.
| Loc | The source location we are interested in finding out the diagnostic state. Can be null in order to query the latest state. |
Definition at line 992 of file Diagnostic.h.
References clang::diag::Ignored.
Referenced by applyCocoaAPICheck(), areAnyEnabled(), clang::sema::checkAssignmentLifetime(), clang::sema::checkCaptureByLifetime(), CheckCommaOperands(), CheckConditionalOperator(), CheckConstexprFunctionBody(), CheckCXX98CompatAccessibleCopy(), CheckForDuplicateEnumValues(), CheckLoopBody(), CheckMissingFormatAttribute(), checkNullabilityConsistency(), checkPointerTypesForAssignment(), CheckProtocolMethodDefs(), DiagnoseBaseOrMemInitializerOrder(), DiagnoseForRangeVariableCopies(), DiagnoseMismatchedSelectors(), clang::SemaObjC::DiagnoseMultipleMethodInGlobalPool(), DiagnoseNullConversion(), diagnoseTautologicalComparison(), EvaluateAsStringImpl(), EvaluateValue(), handleFormatSignedness(), clang::inferNoReturnAttr(), clang::InitializationSequence::InitializeFrom(), clang::Sema::isAcceptableTagRedeclaration(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), LookupMemberExpr(), maybeDiagnoseIDCharCompat(), clang::lifetimes::ShouldCheckFieldOriginEscape(), clang::lifetimes::ShouldCheckInapplicableLifetimebound(), clang::lifetimes::ShouldCheckLifetimeboundViolations(), clang::lifetimes::ShouldCheckMisplacedLifetimebound(), clang::lifetimes::ShouldCheckNoescapeViolations(), clang::lifetimes::ShouldCheckSafety(), clang::sema::shouldRunGSLAssignmentAnalysis(), shouldRunUnsafeBufferUsageAnalysis(), clang::lifetimes::ShouldSuggestLifetimeAnnotations(), and shouldWarnIfShadowedDecl().
|
inline |
Determine whether the previous diagnostic was ignored.
This can be used by clients that want to determine whether notes attached to a diagnostic will be suppressed.
Definition at line 842 of file Diagnostic.h.
References Ignored.
Referenced by DiagnoseUninitializedConstPtrUse(), DiagnoseUninitializedConstRefUse(), DiagnoseUninitializedUse(), and clang::driver::modules::runModulesDriver().
| bool DiagnosticsEngine::isSuppressedViaMapping | ( | diag::kind | DiagId, |
| SourceLocation | DiagLoc ) const |
Definition at line 622 of file Diagnostic.cpp.
References getSourceManager(), and hasSourceManager().
|
inline |
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a note to that diagnostic.
Definition at line 968 of file Diagnostic.h.
References DiagnosticsEngine(), and clang::Other.
|
delete |
References DiagnosticsEngine().
|
inline |
Call this after showing N overload candidates.
This influences the value returned by later calls to getNumOverloadCandidatesToShow().
Definition at line 818 of file Diagnostic.h.
Referenced by clang::ImplicitConversionSequence::DiagnoseAmbiguousConversion(), clang::OverloadCandidateSet::NoteCandidates(), and noteOverloads().
|
inline |
Determine whether this DiagnosticsEngine object own its client.
Definition at line 649 of file Diagnostic.h.
Referenced by SetUpDiagnosticLog(), and SetupSerializedDiagnostics().
| bool DiagnosticsEngine::popMappings | ( | SourceLocation | Loc | ) |
Pops the current DiagMappings off the top of the stack, causing the new top of the stack to be the active mappings.
true if the pop happens, false if there is only one DiagMapping on the stack. Definition at line 111 of file Diagnostic.cpp.
| void DiagnosticsEngine::pushMappings | ( | SourceLocation | Loc | ) |
Copies the current DiagMappings and pushes the new copy onto the top of the stack.
Definition at line 107 of file Diagnostic.cpp.
| void DiagnosticsEngine::Report | ( | const StoredDiagnostic & | storedDiag | ) |
Definition at line 629 of file Diagnostic.cpp.
References Diagnostic, clang::DiagnosticStorage::DiagRanges, clang::StoredDiagnostic::fixit_begin(), clang::StoredDiagnostic::fixit_end(), clang::DiagnosticStorage::FixItHints, clang::StoredDiagnostic::getID(), clang::StoredDiagnostic::getLevel(), clang::StoredDiagnostic::getLocation(), clang::StoredDiagnostic::getMessage(), clang::StoredDiagnostic::range_begin(), clang::StoredDiagnostic::range_end(), and clang::sema::Report.
|
inline |
Issue the message to the client.
This actually returns an instance of DiagnosticBuilder which emits the diagnostics (through ProcessDiag) when it is destroyed.
| DiagID | A member of the diag::kind enum. |
| Loc | Represents the source location associated with the diagnostic, which can be an invalid location if no position information is available. |
Definition at line 1655 of file Diagnostic.h.
References DiagnosticBuilder.
Referenced by clang::TargetInfo::adjust(), clang::AttachHeaderIncludeGen(), clang::FrontendAction::BeginSourceFile(), clang::driver::Driver::BuildCompilation(), buildCompilation(), checkAliasedGlobal(), checkAliasForTocData(), CheckAtomicAlignment(), checkAtomicAlignment(), clang::TargetInfo::checkCFBranchLabelSchemeSupported(), clang::targets::RISCVTargetInfo::checkCFBranchLabelSchemeSupported(), clang::TargetInfo::checkCFProtectionBranchSupported(), clang::TargetInfo::checkCFProtectionReturnSupported(), checkDiagnosticGroupMappings(), checkDiagnosticMappings(), checkHeaderSearchPaths(), checkModuleCachePath(), checkMSVCHeaderSearch(), checkPreprocessorOptions(), checkPrivateAPINotesName(), CheckResultsAreInOrder(), clang::CodeGenUtils::checkTargetFeatures(), clang::CodeGenUtils::checkTargetFeatures(), checkTargetOptions(), checkVerifyPrefixes(), collectClobbers(), clang::CompilerInstance::compileModule(), compileModuleBehindLockOrRead(), compileModuleImpl(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::CreateFrontendAction(), clang::CreateFrontendBaseAction(), createModuleDependencyEdges(), clang::CompilerInstance::createModuleFromSource(), clang::CompilerInstance::createOutputFile(), clang::CompilerInstance::createTarget(), clang::TargetInfo::CreateTargetInfo(), clang::createVFSFromOverlayFiles(), DefineBuiltinMacro(), Diag(), clang::Lexer::DiagnoseDelimitedOrNamedEscapeSequence(), clang::OpenCLOptions::diagnoseFeatureExtensionDifferences(), diagnoseFrameworkInclude(), diagnoseIfNeedsFPReg(), DiagnoseInvalidUnicodeCharacterName(), diagnoseLanguageOptionFlagMismatch(), diagnoseLanguageOptionValueMismatch(), diagnoseMathematicalNotationInIdentifier(), clang::driver::modules::diagnoseModulesDriverArgs(), diagnoseSubMismatchMethodParameters(), clang::OpenCLOptions::diagnoseUnsupportedFeatureDependencies(), clang::EmbedObject(), cir::embedSYCLDeviceBinary(), emitAsmStores(), clang::CodeGen::CodeGenFunction::EmitAtomicExpr(), clang::CodeGen::CodeGenFunction::EmitAutoVarCleanups(), clang::emitBackendOutput(), emitCallStackNotes(), emitCommonOMPTargetDirective(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), clang::PartialDiagnostic::EmitToString(), EmitUnknownDiagWarning(), EnableCodeCompletion(), EncodeUCNEscape(), clang::CodeGen::CodeGenModule::Error(), clang::CIRGen::CIRGenModule::error(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::CodeGen::CGCXXABI::ErrorUnsupportedABI(), cir::CIRGenAction::ExecuteAction(), clang::CompilerInstance::ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::CodeGen::CodeGenFunction::ExitSEHTryStmt(), FixupInvocation(), clang::TextDiagnosticBuffer::FlushDiagnostics(), clang::tooling::getCC1Arguments(), getInputBufferForModule(), getObjCEncodingForPrimitiveType(), clang::CodeGen::CodeGenModule::GetOrCreateLLVMGlobal(), getPrivateModuleMap(), getRefinementStep(), getUnionInitName(), clang::interp::handleFixedPointOverflow(), clang::hlsl::HandleRootSignatureTarget(), clang::targets::ARMTargetInfo::handleTargetFeatures(), clang::targets::RISCVTargetInfo::handleTargetFeatures(), clang::targets::X86TargetInfo::handleTargetFeatures(), clang::CXX20ModulesGenerator::HandleTranslationUnit(), clang::TargetInfo::initFeatureMap(), clang::targets::AMDGPUTargetInfo::initFeatureMap(), clang::targets::PPCTargetInfo::initFeatureMap(), clang::targets::RISCVTargetInfo::initFeatureMap(), InitializeFileRemapping(), clang::CompilerInstance::InitializeSourceManager(), initOption(), initOption(), initOption(), initTargetOptions(), insertAndValidate(), isOptionContainedIn(), clang::loadLinkModules(), clang::CompilerInstance::loadModule(), clang::CompilerInstance::loadModuleFile(), clang::CompilerInstance::LoadRequestedPlugins(), maybeDiagnoseIDCharCompat(), maybeDiagnoseUTF8Homoglyph(), normalizeSimpleEnum(), normalizeStringIntegral(), ParseAnalyzerArgs(), parseAnalyzerConfigs(), ParseAPINotesArgs(), ParseDependencyOutputArgs(), parseDiagnosticLevelMask(), ParseDirective(), ParseFrontendArgs(), clang::parseMPreferVectorWidthOption(), ParseOptimizationRemark(), parseOutputFileFormatAndPathOrReportError(), ParsePreprocessorArgs(), parseSanitizerKinds(), parseSanitizerWeightedKinds(), ParseTargetArgs(), parseXRayInstrumentationBundle(), ppcUserFeaturesCheck(), prepareToBuildModule(), clang::GenerateModuleInterfaceAction::PrepareToExecuteAction(), PrintExpected(), PrintPartial(), clang::CodeGen::CodeGenModule::printPostfixForExternalizedDecl(), PrintUnexpected(), clang::ProcessWarningOptions(), readASTAfterCompileModule(), clang::CodeGen::CodeGenModule::Release(), clang::CodeGen::InstrProfStats::reportDiagnostics(), clang::ento::CheckerManager::reportInvalidCheckerOptionValue(), clang::reportOptRecordError(), reportOrphanOptionMisuse(), reportUnrecognizedExtractorNames(), rewriteToNumericBoxedExpression(), RoundTrip(), clang::driver::modules::runModulesDriver(), selectBestPath(), clang::CodeGen::CodeGenModule::setGlobalVisibility(), WebAssemblyTargetCodeGenInfo::setTargetAttributes(), SetUpDiagnosticLog(), clang::CodeGen::CodeGenModule::stopAutoInit(), validateAArch64Simdlen(), clang::TargetInfo::validateOpenCLTarget(), validateScannedJobInputKinds(), clang::targets::AArch64TargetInfo::validateTarget(), clang::targets::MipsTargetInfo::validateTarget(), and clang::targets::SPIRVTargetInfo::validateTarget().
|
inline |
Definition at line 1663 of file Diagnostic.h.
References DiagnosticBuilder, and clang::sema::Report.
Reset the state of the diagnostic object to its initial configuration.
| [in] | soft | - if true, doesn't reset the diagnostic mappings and state |
Definition at line 125 of file Diagnostic.cpp.
References Ignored.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::dependencies::CompilerInstanceWithContext::computeDependencies(), and clang::ASTUnit::Reparse().
| void DiagnosticsEngine::ResetPragmas | ( | ) |
We keep a cache of FileIDs for diagnostics mapped by pragmas.
These might get invalidated when diagnostics engine is shared across different compilations. Provide users with a way to reset that.
Definition at line 123 of file Diagnostic.cpp.
|
inline |
Definition at line 961 of file Diagnostic.h.
Referenced by clang::ASTMergeAction::ExecuteAction().
| void DiagnosticsEngine::setClient | ( | DiagnosticConsumer * | client, |
| bool | ShouldOwnClient = true ) |
Set the diagnostic client associated with this diagnostic object.
| ShouldOwnClient | true if the diagnostic object should take ownership of client. |
Definition at line 101 of file Diagnostic.cpp.
Referenced by DiagnosticsEngine(), RoundTrip(), SetUpDiagnosticLog(), SetupSerializedDiagnostics(), and ~DiagnosticsEngine().
|
inline |
Specify the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
Definition at line 708 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
Set the error-as-fatal flag for the given diagnostic group.
This function always only operates on the current diagnostic state.
Definition at line 471 of file Diagnostic.cpp.
References Diag(), clang::diag::Error, clang::diag::Fatal, clang::DiagnosticMapping::getSeverity(), clang::DiagnosticMapping::setNoErrorAsFatal(), clang::DiagnosticMapping::setSeverity(), setSeverityForGroup(), and clang::diag::WarningOrError.
Referenced by clang::ProcessWarningOptions().
Set the warning-as-error flag for the given diagnostic group.
This function always only operates on the current diagnostic state.
Definition at line 439 of file Diagnostic.cpp.
References Diag(), clang::diag::Error, clang::diag::Fatal, clang::DiagnosticMapping::getSeverity(), clang::DiagnosticMapping::setNoWarningAsError(), clang::DiagnosticMapping::setSeverity(), setSeverityForGroup(), clang::diag::Warning, and clang::diag::WarningOrError.
Referenced by clang::ProcessWarningOptions().
| void DiagnosticsEngine::setDiagSuppressionMapping | ( | llvm::MemoryBuffer & | Input | ) |
Diagnostic suppression mappings can be used to suppress specific diagnostics in specific files.
Mapping file is expected to be a special case list with sections denoting diagnostic groups and src entries for globs to suppress. emit category can be used to disable suppression. The last glob that matches a filepath takes precedence. For example: [unused] src:clang/* src:clang/foo/*=emit src:clang/foo/bar/*
Such a mappings file suppress all diagnostics produced by -Wunused in all sources under clang/ directory apart from clang/foo/. Diagnostics under clang/foo/bar/ will also be suppressed. Note that the FilePath is matched against the globs as-is. These take presumed locations into account, and can still be overriden by clang-diagnostics pragmas.
Definition at line 573 of file Diagnostic.cpp.
References Error, and clang::sema::Report.
Referenced by clang::ProcessWarningOptions().
|
inline |
Set type eliding, to skip outputting same types occurring in template types.
Definition at line 776 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
When set to true, any unmapped ignored warnings are no longer ignored.
If this and IgnoreAllWarnings are both set, then that one wins.
Definition at line 732 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
Specify a limit for the number of errors we should emit before giving up.
Zero disables the limit.
Definition at line 694 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
When set to true, any error reported is made a fatal error.
Definition at line 748 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
Controls whether otherwise-unmapped extension diagnostics are mapped onto ignore/warning/error.
This corresponds to the GCC -pedantic and -pedantic-errors option.
Definition at line 848 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
When set to true, any fatal error reported is made an error.
This setting takes precedence over the setErrorsAsFatal setting above.
Definition at line 754 of file Diagnostic.h.
|
inline |
Definition at line 771 of file Diagnostic.h.
|
inline |
When set to true, any unmapped warnings are ignored.
If this and WarningsAsErrors are both set, then this one wins.
Definition at line 721 of file Diagnostic.h.
Referenced by initializeScanCompilerInstance(), and clang::ProcessWarningOptions().
|
inline |
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed, or restore a prior ignoring state after ignoring some diagnostics and their notes, possibly in the middle of another diagnostic.
This can be used by clients who suppress diagnostics themselves.
Definition at line 833 of file Diagnostic.h.
|
inline |
Definition at line 930 of file Diagnostic.h.
Referenced by clang::ASTUnit::Reparse().
|
inline |
Set tree printing, to outputting the template difference in a tree format.
Definition at line 781 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
| void DiagnosticsEngine::setSeverity | ( | diag::kind | Diag, |
| diag::Severity | Map, | ||
| SourceLocation | Loc ) |
This allows the client to specify that certain warnings are ignored.
Notes can never be mapped, errors can only be mapped to fatal, and WARNINGs and EXTENSIONs can be mapped arbitrarily.
| Loc | The source location that this change of diagnostic state should take affect. It can be null if we are setting the latest state. |
Definition at line 368 of file Diagnostic.cpp.
References Diag(), clang::diag::Error, clang::diag::Fatal, clang::DiagnosticMapping::getSeverity(), clang::DiagnosticMapping::hasNoWarningAsError(), clang::SourceLocation::isInvalid(), clang::DiagnosticMapping::setNoWarningAsError(), clang::DiagnosticMapping::setUpgradedFromWarning(), and clang::diag::Warning.
Referenced by clang::InitializePreprocessor(), clang::Interpreter::Parse(), setSeverityForAll(), and setSeverityForGroup().
| void DiagnosticsEngine::setSeverityForAll | ( | diag::Flavor | Flavor, |
| diag::Severity | Map, | ||
| SourceLocation | Loc = SourceLocation() ) |
Add the specified mapping to all diagnostics of the specified flavor.
Mainly to be used by -Wno-everything to disable all warnings but allow subsequent -W options to enable specific warnings.
Definition at line 502 of file Diagnostic.cpp.
References Diag(), clang::DiagnosticIDs::getAllDiagnostics(), and setSeverity().
Referenced by clang::ProcessWarningOptions().
| bool DiagnosticsEngine::setSeverityForGroup | ( | diag::Flavor | Flavor, |
| diag::Group | Group, | ||
| diag::Severity | Map, | ||
| SourceLocation | Loc = SourceLocation() ) |
Definition at line 431 of file Diagnostic.cpp.
References setSeverityForGroup().
| bool DiagnosticsEngine::setSeverityForGroup | ( | diag::Flavor | Flavor, |
| StringRef | Group, | ||
| diag::Severity | Map, | ||
| SourceLocation | Loc = SourceLocation() ) |
Change an entire diagnostic group (e.g.
"unknown-pragmas") to have the specified mapping.
| Flavor | The flavor of group to affect. -Rfoo does not affect the state of the -Wfoo group and vice versa. |
| Loc | The source location that this change of diagnostic state should take affect. It can be null if we are setting the state from command-line. |
Definition at line 414 of file Diagnostic.cpp.
References Diag(), and setSeverity().
Referenced by clang::ProcessWarningOptions(), setDiagnosticGroupErrorAsFatal(), setDiagnosticGroupWarningAsError(), and setSeverityForGroup().
|
inline |
Set color printing, so the type diffing will inject color markers into the output.
Definition at line 786 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
Specify which overload candidates to show when overload resolution fails.
By default, we show all candidates.
Definition at line 793 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
Definition at line 662 of file Diagnostic.h.
|
inline |
Suppress all diagnostics, to silence the front end when we know that we don't want any more diagnostics to be passed along to the client.
Definition at line 768 of file Diagnostic.h.
Referenced by clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), and clang::Preprocessor::setCodeCompletionReached().
|
inline |
When set to true mask warnings that come from system headers.
Definition at line 758 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
Specify the maximum number of template instantiation notes to emit along with a given diagnostic.
Definition at line 698 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
|
inline |
When set to true, any warnings reported are issued as errors.
Definition at line 740 of file Diagnostic.h.
Referenced by clang::ento::CreateAnalysisConsumer(), and clang::ProcessWarningOptions().
|
inline |
Return the current diagnostic client along with ownership of that client.
Definition at line 653 of file Diagnostic.h.
Referenced by SetUpDiagnosticLog(), and SetupSerializedDiagnostics().
|
friend |
|
friend |
|
friend |
Definition at line 1060 of file Diagnostic.h.
References Diagnostic.
Referenced by Diagnostic, EmitDiagnostic(), and Report().
|
friend |
Definition at line 1061 of file Diagnostic.h.
References DiagnosticBuilder.
Referenced by DiagnosticBuilder, EmitDiagnostic(), Report(), Report(), and Sema.
|
friend |
Definition at line 1062 of file Diagnostic.h.
References DiagnosticErrorTrap.
Referenced by DiagnosticErrorTrap.
|
friend |
Definition at line 1063 of file Diagnostic.h.
References DiagnosticIDs.
Referenced by DiagnosticIDs.
|
friend |
References DiagnosticsEngine().
|
friend |
Definition at line 1064 of file Diagnostic.h.
References clang::DiagnosticStorage::MaxArguments, and PartialDiagnostic.
Referenced by PartialDiagnostic.
|
friend |
Definition at line 1110 of file Diagnostic.h.
References DiagnosticBuilder, and Sema.
Referenced by Sema.