clang API Documentation
Concrete class used by the front-end to report problems and issues. More...
#include <Diagnostic.h>
Classes | |
class | DiagState |
Mapping information for diagnostics. | |
struct | DiagStatePoint |
Represents a point in source where the diagnostic state was modified because of a pragma. | |
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_qualtype, ak_declarationname, ak_nameddecl, ak_nestednamespec, ak_declcontext, ak_qualtype_pair, ak_attr } |
typedef std::pair < ArgumentKind, intptr_t > | ArgumentValue |
Represents on argument value, which is a union discriminated by ArgumentKind, with a value. | |
typedef llvm::iterator_range < DiagState::const_iterator > | diag_mapping_range |
Public Member Functions | |
DiagnosticsEngine (const IntrusiveRefCntPtr< DiagnosticIDs > &Diags, DiagnosticOptions *DiagOpts, DiagnosticConsumer *client=nullptr, bool ShouldOwnClient=true) | |
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 | setSuppressSystemWarnings (bool Val) |
When set to true mask warnings that come from system headers. | |
bool | getSuppressSystemWarnings () const |
void | setSuppressAllDiagnostics (bool Val=true) |
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 | setElideType (bool Val=true) |
Set type eliding, to skip outputting same types occurring in template types. | |
bool | getElideType () |
void | setPrintTemplateTree (bool Val=false) |
Set tree printing, to outputting the template difference in a tree format. | |
bool | getPrintTemplateTree () |
void | setShowColors (bool Val=false) |
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 |
void | setLastDiagnosticIgnored () |
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed. | |
bool | isLastDiagnosticIgnored () const |
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. | |
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. "unknown-pragmas") to have the specified mapping. | |
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 | 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 () |
Reset the state of the diagnostic object to its initial configuration. | |
bool | isIgnored (unsigned DiagID, SourceLocation Loc) const |
Determine whether the diagnostic is known to be ignored. | |
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. | |
DiagnosticBuilder | Report (SourceLocation Loc, unsigned DiagID) |
Issue the message to the client. | |
DiagnosticBuilder | Report (unsigned DiagID) |
void | Report (const StoredDiagnostic &storedDiag) |
bool | isDiagnosticInFlight () const |
Determine whethere there is already a diagnostic in flight. | |
void | SetDelayedDiagnostic (unsigned DiagID, StringRef Arg1="", StringRef Arg2="") |
Set the "delayed" diagnostic that will be emitted once the current diagnostic completes. | |
void | Clear () |
Clear out the current diagnostic. | |
StringRef | getFlagValue () const |
Return the value associated with this diagnostic flag. | |
Friends | |
class | DiagnosticIDs |
class | DiagnosticBuilder |
class | Diagnostic |
class | PartialDiagnostic |
class | DiagnosticErrorTrap |
class | ASTReader |
class | ASTWriter |
Diagnostic Emission | |
class | Sema |
bool | EmitCurrentDiagnostic (bool Force=false) |
Emit the current diagnostic and clear the diagnostic state. | |
unsigned | getCurrentDiagID () const |
SourceLocation | getCurrentDiagLoc () const |
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 134 of file Diagnostic.h.
typedef std::pair<ArgumentKind, intptr_t> clang::DiagnosticsEngine::ArgumentValue |
Represents on argument value, which is a union discriminated by ArgumentKind, with a value.
Definition at line 167 of file Diagnostic.h.
typedef llvm::iterator_range<DiagState::const_iterator> clang::DiagnosticsEngine::diag_mapping_range |
Definition at line 358 of file Diagnostic.h.
ak_std_string |
std::string |
ak_c_string |
const char * |
ak_sint |
int |
ak_uint |
unsigned |
ak_tokenkind |
enum TokenKind : unsigned |
ak_identifierinfo | |
ak_qualtype | |
ak_declarationname | |
ak_nameddecl |
NamedDecl *. |
ak_nestednamespec | |
ak_declcontext |
DeclContext *. |
ak_qualtype_pair |
pair<QualType, QualType> |
ak_attr |
Attr *. |
Definition at line 149 of file Diagnostic.h.
The level of the diagnostic, after it has been through mapping.
Definition at line 140 of file Diagnostic.h.
DiagnosticsEngine::DiagnosticsEngine | ( | const IntrusiveRefCntPtr< DiagnosticIDs > & | Diags, |
DiagnosticOptions * | DiagOpts, | ||
DiagnosticConsumer * | client = nullptr , |
||
bool | ShouldOwnClient = true |
||
) | [explicit] |
Definition at line 36 of file Diagnostic.cpp.
References DummyArgToStringFn(), Ignored, clang::Ovl_All, Reset(), and setClient().
void clang::DiagnosticsEngine::Clear | ( | ) | [inline] |
Clear out the current diagnostic.
Definition at line 703 of file Diagnostic.h.
Referenced by clang::FixItRewriter::Diag(), EmitCurrentDiagnostic(), clang::Sema::EmitCurrentDiagnostic(), and clang::PartialDiagnostic::EmitToString().
void clang::DiagnosticsEngine::ConvertArgToString | ( | ArgumentKind | Kind, |
intptr_t | Val, | ||
StringRef | Modifier, | ||
StringRef | Argument, | ||
ArrayRef< ArgumentValue > | PrevArgs, | ||
SmallVectorImpl< char > & | Output, | ||
ArrayRef< intptr_t > | QualTypeVals | ||
) | const [inline] |
Converts a diagnostic argument (as an intptr_t) into the string that represents it.
Definition at line 607 of file Diagnostic.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitCheckTypeDescriptor(), and clang::Diagnostic::FormatDiagnostic().
void clang::DiagnosticsEngine::DecrementAllExtensionsSilenced | ( | ) | [inline] |
Definition at line 521 of file Diagnostic.h.
Referenced by clang::ExtensionRAIIObject::~ExtensionRAIIObject().
bool DiagnosticsEngine::EmitCurrentDiagnostic | ( | bool | Force = false | ) | [protected] |
Emit the current diagnostic and clear the diagnostic state.
Force | Emit the diagnostic regardless of suppression settings. |
Definition at line 342 of file Diagnostic.cpp.
References Clear(), getClient(), clang::Diagnostic::getID(), clang::Diagnostic::getLocation(), and Ignored.
Referenced by clang::DiagnosticBuilder::Emit(), and clang::Sema::EmitCurrentDiagnostic().
DiagnosticConsumer* clang::DiagnosticsEngine::getClient | ( | ) | [inline] |
Definition at line 366 of file Diagnostic.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), EmitCurrentDiagnostic(), clang::ASTMergeAction::ExecuteAction(), clang::CompilerInstance::ExecuteAction(), clang::FixItRewriter::FixItRewriter(), SetupSerializedDiagnostics(), and clang::ASTUnit::~ASTUnit().
const DiagnosticConsumer* clang::DiagnosticsEngine::getClient | ( | ) | const [inline] |
Definition at line 367 of file Diagnostic.h.
unsigned clang::DiagnosticsEngine::getConstexprBacktraceLimit | ( | ) | const [inline] |
Retrieve the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
Definition at line 431 of file Diagnostic.h.
unsigned clang::DiagnosticsEngine::getCurrentDiagID | ( | ) | const [inline, protected] |
Definition at line 807 of file Diagnostic.h.
Referenced by clang::Sema::EmitCurrentDiagnostic().
SourceLocation clang::DiagnosticsEngine::getCurrentDiagLoc | ( | ) | const [inline, protected] |
Definition at line 809 of file Diagnostic.h.
Referenced by clang::Sema::EmitCurrentDiagnostic().
unsigned clang::DiagnosticsEngine::getCustomDiagID | ( | Level | L, |
const char(&) | FormatString[N] | ||
) | [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 600 of file Diagnostic.h.
Referenced by clang::CodeGen::CodeGenModule::CodeGenModule(), clang::CodeGen::CodeGenModule::Error(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::CodeGen::CGCXXABI::ErrorUnsupportedABI(), clang::CodeGenAction::ExecuteAction(), clang::TextDiagnosticBuffer::FlushDiagnostics(), InvalidPTH(), reportDiag(), and rewriteToNumericBoxedExpression().
const IntrusiveRefCntPtr<DiagnosticIDs>& clang::DiagnosticsEngine::getDiagnosticIDs | ( | ) | const [inline] |
Definition at line 351 of file Diagnostic.h.
Referenced by checkDiagnosticGroupMappings(), clang::ASTMergeAction::ExecuteAction(), clang::Diagnostic::FormatDiagnostic(), clang::html::HighlightMacros(), clang::ProcessWarningOptions(), and clang::PCHValidator::ReadDiagnosticOptions().
Level clang::DiagnosticsEngine::getDiagnosticLevel | ( | unsigned | DiagID, |
SourceLocation | Loc | ||
) | const [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 658 of file Diagnostic.h.
Referenced by checkDiagnosticGroupMappings().
diag_mapping_range clang::DiagnosticsEngine::getDiagnosticMappings | ( | ) | const [inline] |
Get the current set of diagnostic mappings.
Definition at line 361 of file Diagnostic.h.
DiagnosticOptions& clang::DiagnosticsEngine::getDiagnosticOptions | ( | ) | const [inline] |
Retrieve the diagnostic options.
Definition at line 356 of file Diagnostic.h.
Referenced by clang::html::HighlightMacros().
bool clang::DiagnosticsEngine::getElideType | ( | ) | [inline] |
Definition at line 471 of file Diagnostic.h.
bool clang::DiagnosticsEngine::getEnableAllWarnings | ( | ) | const [inline] |
Definition at line 446 of file Diagnostic.h.
Referenced by checkDiagnosticMappings().
bool clang::DiagnosticsEngine::getErrorsAsFatal | ( | ) | const [inline] |
Definition at line 454 of file Diagnostic.h.
diag::Severity clang::DiagnosticsEngine::getExtensionHandlingBehavior | ( | ) | const [inline] |
Definition at line 514 of file Diagnostic.h.
Referenced by HasExtension(), and isExtHandlingFromDiagsError().
StringRef clang::DiagnosticsEngine::getFlagValue | ( | ) | const [inline] |
Return the value associated with this diagnostic flag.
Definition at line 706 of file Diagnostic.h.
Referenced by printDiagnosticOptions().
bool clang::DiagnosticsEngine::getIgnoreAllWarnings | ( | ) | const [inline] |
Definition at line 439 of file Diagnostic.h.
unsigned clang::DiagnosticsEngine::getNumWarnings | ( | ) | const [inline] |
Definition at line 585 of file Diagnostic.h.
bool clang::DiagnosticsEngine::getPrintTemplateTree | ( | ) | [inline] |
Definition at line 476 of file Diagnostic.h.
bool clang::DiagnosticsEngine::getShowColors | ( | ) | [inline] |
Definition at line 481 of file Diagnostic.h.
OverloadsShown clang::DiagnosticsEngine::getShowOverloads | ( | ) | const [inline] |
Definition at line 490 of file Diagnostic.h.
Referenced by clang::ImplicitConversionSequence::DiagnoseAmbiguousConversion(), clang::TemplateSpecCandidateSet::NoteCandidates(), clang::OverloadCandidateSet::NoteCandidates(), and noteOverloads().
SourceManager& clang::DiagnosticsEngine::getSourceManager | ( | ) | const [inline] |
Definition at line 377 of file Diagnostic.h.
Referenced by clang::Diagnostic::getSourceManager(), and clang::VerifyDiagnosticConsumer::VerifyDiagnosticConsumer().
bool clang::DiagnosticsEngine::getSuppressAllDiagnostics | ( | ) | const [inline] |
Definition at line 466 of file Diagnostic.h.
Referenced by clang::Sema::ActOnOpenMPReductionClause(), and clang::Sema::tryExprAsCall().
bool clang::DiagnosticsEngine::getSuppressSystemWarnings | ( | ) | const [inline] |
Definition at line 458 of file Diagnostic.h.
Referenced by checkDiagnosticMappings(), and clang::sema::AnalysisBasedWarnings::IssueWarnings().
unsigned clang::DiagnosticsEngine::getTemplateBacktraceLimit | ( | ) | const [inline] |
Retrieve the maximum number of template instantiation notes to emit along with a given diagnostic.
Definition at line 419 of file Diagnostic.h.
Referenced by clang::Sema::PrintInstantiationStack().
bool clang::DiagnosticsEngine::getWarningsAsErrors | ( | ) | const [inline] |
Definition at line 450 of file Diagnostic.h.
Referenced by checkDiagnosticMappings(), and isExtHandlingFromDiagsError().
bool clang::DiagnosticsEngine::hasAllExtensionsSilenced | ( | ) | [inline] |
Definition at line 522 of file Diagnostic.h.
bool clang::DiagnosticsEngine::hasErrorOccurred | ( | ) | const [inline] |
Definition at line 571 of file Diagnostic.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::driver::Driver::BuildJobs(), compileAndLoadModule(), clang::driver::Driver::ExecuteCompilation(), clang::ExecuteCompilerInvocation(), clang::Sema::FindInstantiatedDecl(), clang::PCHGenerator::HandleTranslationUnit(), clang::ASTUnit::serialize(), and clang::FrontendAction::shouldEraseOutputFiles().
bool clang::DiagnosticsEngine::hasFatalErrorOccurred | ( | ) | const [inline] |
Definition at line 578 of file Diagnostic.h.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
bool clang::DiagnosticsEngine::hasSourceManager | ( | ) | const [inline] |
Definition at line 376 of file Diagnostic.h.
Referenced by clang::Diagnostic::hasSourceManager(), and clang::VerifyDiagnosticConsumer::VerifyDiagnosticConsumer().
bool clang::DiagnosticsEngine::hasUncompilableErrorOccurred | ( | ) | const [inline] |
Errors that actually prevent compilation, not those that are upgraded from a warning by -Werror.
Definition at line 575 of file Diagnostic.h.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
bool clang::DiagnosticsEngine::hasUnrecoverableErrorOccurred | ( | ) | const [inline] |
Determine whether any kind of unrecoverable error has occurred.
Definition at line 581 of file Diagnostic.h.
Referenced by clang::arcmt::TransformActions::hasReportedErrors().
void clang::DiagnosticsEngine::IncrementAllExtensionsSilenced | ( | ) | [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 520 of file Diagnostic.h.
Referenced by clang::ExtensionRAIIObject::ExtensionRAIIObject().
bool clang::DiagnosticsEngine::isDiagnosticInFlight | ( | ) | const [inline] |
Determine whethere there is already a diagnostic in flight.
Definition at line 676 of file Diagnostic.h.
Referenced by clang::SrcMgr::ContentCache::getBuffer().
bool clang::DiagnosticsEngine::isIgnored | ( | unsigned | DiagID, |
SourceLocation | Loc | ||
) | const [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 643 of file Diagnostic.h.
References Ignored.
Referenced by clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::ActOnEndOfTranslationUnit(), applyCocoaAPICheck(), clang::Sema::BuildInstanceMessage(), clang::Sema::CheckCompatibleReinterpretCast(), CheckCXX98CompatAccessibleCopy(), CheckForDuplicateEnumValues(), CheckProtocolMethodDefs(), DiagnoseBadFunctionCast(), DiagnoseBaseOrMemInitializerOrder(), clang::Sema::DiagnoseHiddenVirtualMethods(), DiagnoseMismatchedSelectors(), clang::Sema::DiagnoseUnusedBackingIvarInAccessor(), clang::Preprocessor::HandleEndOfFile(), isEnabled(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), clang::HeaderSearch::LookupFile(), LookupMemberExpr(), and maybeDiagnoseIDCharCompat().
bool clang::DiagnosticsEngine::isLastDiagnosticIgnored | ( | ) | const [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 505 of file Diagnostic.h.
References Ignored.
Referenced by clang::Sema::DiagnoseAbstractType().
void clang::DiagnosticsEngine::notePriorDiagnosticFrom | ( | const DiagnosticsEngine & | Other | ) | [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 623 of file Diagnostic.h.
Referenced by clang::ASTImporter::FromDiag(), and clang::ASTImporter::ToDiag().
bool clang::DiagnosticsEngine::ownsClient | ( | ) | const [inline] |
Determine whether this DiagnosticsEngine
object own its client.
Definition at line 370 of file Diagnostic.h.
Referenced by SetUpDiagnosticLog(), and SetupSerializedDiagnostics().
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 74 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 70 of file Diagnostic.cpp.
DiagnosticBuilder clang::DiagnosticsEngine::Report | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) | [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 1102 of file Diagnostic.h.
References DiagnosticBuilder.
Referenced by AddImplicitIncludePTH(), clang::AttachHeaderIncludeGen(), clang::FrontendAction::BeginSourceFile(), clang::GenerateModuleAction::BeginSourceFileAction(), checkDiagnosticGroupMappings(), checkDiagnosticMappings(), checkLanguageOptions(), checkMSVCHeaderSearch(), checkPreprocessorOptions(), checkTargetOptions(), clang::CompilerInstance::clearOutputFiles(), clang::CodeGen::CodeGenModule::CodeGenModule(), compileAndLoadModule(), compileModuleImpl(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::PTHManager::Create(), clang::DependencyFileGenerator::CreateAndAttachToPreprocessor(), clang::CodeGenAction::CreateASTConsumer(), clang::ento::createCheckerManager(), clang::CompilerInstance::createCodeCompletionConsumer(), clang::CompilerInvocation::CreateFromArgs(), CreateFrontendBaseAction(), clang::CompilerInstance::createOutputFile(), clang::TargetInfo::CreateTargetInfo(), clang::createVFSFromCompilerInvocation(), DefineBuiltinMacro(), Diag(), clang::driver::Driver::Diag(), clang::FixItRewriter::Diag(), clang::Parser::Diag(), clang::Preprocessor::Diag(), clang::Sema::Diag(), clang::ASTReader::Diag(), clang::ModuleMap::diagnoseHeaderInclusion(), clang::CodeGen::CodeGenFunction::EmitAsmStmt(), clang::PartialDiagnostic::EmitToString(), EmitUnknownDiagWarning(), EnableCodeCompletion(), clang::CodeGen::CodeGenModule::Error(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::CodeGen::CGCXXABI::ErrorUnsupportedABI(), clang::CodeGenAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), clang::TextDiagnosticBuffer::FlushDiagnostics(), clang::ASTImporter::FromDiag(), GenerateOptimizationRemarkRegex(), clang::SrcMgr::ContentCache::getBuffer(), clang::tooling::getCC1Arguments(), getCodeModel(), clang::getLastArgIntValueImpl(), clang::ASTReader::getOriginalSourceFile(), InitializeFileRemapping(), clang::CompilerInstance::InitializeSourceManager(), InvalidPTH(), clang::CompilerInstance::loadModule(), clang::CompilerInstance::loadModuleFile(), maybeDiagnoseIDCharCompat(), clang::RecordDecl::mayInsertExtraPadding(), ParseAnalyzerArgs(), clang::driver::Driver::ParseArgStrings(), ParseCodeGenArgs(), ParseDirective(), ParseFrontendArgs(), ParseLangArgs(), clang::ModuleMapParser::parseModuleMapFile(), parseMSCVersion(), ParsePreprocessorArgs(), parseVisibility(), PrintExpected(), clang::Sema::PrintInstantiationStack(), PrintUnexpected(), clang::ProcessWarningOptions(), clang::arcmt::TransformActions::report(), Report(), reportDiag(), clang::arcmt::CapturedDiagList::reportDiagnostics(), clang::CodeGen::InstrProfStats::reportDiagnostics(), rewriteToNumericBoxedExpression(), SetUpDiagnosticLog(), clang::ASTImporter::ToDiag(), and clang::FixItRewriter::WriteFixedFiles().
DiagnosticBuilder clang::DiagnosticsEngine::Report | ( | unsigned | DiagID | ) | [inline] |
Definition at line 1111 of file Diagnostic.h.
References Report().
void DiagnosticsEngine::Report | ( | const StoredDiagnostic & | storedDiag | ) |
Definition at line 309 of file Diagnostic.cpp.
References clang::StoredDiagnostic::fixit_begin(), clang::StoredDiagnostic::fixit_end(), clang::StoredDiagnostic::fixit_size(), clang::StoredDiagnostic::getID(), clang::StoredDiagnostic::getLevel(), clang::StoredDiagnostic::getLocation(), clang::StoredDiagnostic::getMessage(), clang::DiagnosticConsumer::HandleDiagnostic(), clang::DiagnosticConsumer::IncludeInDiagnosticCounts(), clang::StoredDiagnostic::range_begin(), clang::StoredDiagnostic::range_end(), clang::StoredDiagnostic::range_size(), and Warning.
void DiagnosticsEngine::Reset | ( | ) |
Reset the state of the diagnostic object to its initial configuration.
Definition at line 86 of file Diagnostic.cpp.
References Ignored.
Referenced by clang::FixItRecompile::BeginInvocation(), DiagnosticsEngine(), and clang::ASTUnit::Reparse().
void clang::DiagnosticsEngine::SetArgToStringFn | ( | ArgToStringFnTy | Fn, |
void * | Cookie | ||
) | [inline] |
Definition at line 616 of file Diagnostic.h.
Referenced by clang::ASTMergeAction::ExecuteAction(), and clang::Sema::Sema().
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 64 of file Diagnostic.cpp.
Referenced by clang::FixItRewriter::Diag(), DiagnosticsEngine(), clang::FixItRewriter::FixItRewriter(), SetUpDiagnosticLog(), SetupSerializedDiagnostics(), and clang::FixItRewriter::~FixItRewriter().
void clang::DiagnosticsEngine::setConstexprBacktraceLimit | ( | unsigned | Limit | ) | [inline] |
Specify the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
Definition at line 425 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void DiagnosticsEngine::SetDelayedDiagnostic | ( | unsigned | DiagID, |
StringRef | Arg1 = "" , |
||
StringRef | Arg2 = "" |
||
) |
Set the "delayed" diagnostic that will be emitted once the current diagnostic completes.
If a diagnostic is already in-flight but the front end must report a problem (e.g., with an inconsistent file system state), this routine sets a "delayed" diagnostic that will be emitted after the current diagnostic completes. This should only be used for fatal errors detected at inconvenient times. If emitting a delayed diagnostic causes a second delayed diagnostic to be introduced, that second delayed diagnostic will be ignored.
DiagID | The ID of the diagnostic being delayed. |
Arg1 | A string argument that will be provided to the diagnostic. A copy of this string will be stored in the DiagnosticsEngine object itself. |
Arg2 | A string argument that will be provided to the diagnostic. A copy of this string will be stored in the DiagnosticsEngine object itself. |
Definition at line 112 of file Diagnostic.cpp.
Referenced by clang::SrcMgr::ContentCache::getBuffer().
bool DiagnosticsEngine::setDiagnosticGroupErrorAsFatal | ( | StringRef | Group, |
bool | Enabled | ||
) |
Set the error-as-fatal flag for the given diagnostic group.
This function always only operates on the current diagnostic state.
Definition at line 266 of file Diagnostic.cpp.
References clang::diag::Error, clang::diag::Fatal, Fatal, clang::DiagnosticMapping::getSeverity(), clang::DiagnosticMapping::setNoErrorAsFatal(), clang::DiagnosticMapping::setSeverity(), setSeverityForGroup(), and clang::diag::WarningOrError.
Referenced by clang::ProcessWarningOptions().
bool DiagnosticsEngine::setDiagnosticGroupWarningAsError | ( | StringRef | Group, |
bool | Enabled | ||
) |
Set the warning-as-error flag for the given diagnostic group.
This function always only operates on the current diagnostic state.
Definition at line 235 of file Diagnostic.cpp.
References clang::diag::Error, Fatal, clang::DiagnosticMapping::getSeverity(), clang::DiagnosticMapping::setNoWarningAsError(), clang::DiagnosticMapping::setSeverity(), setSeverityForGroup(), clang::diag::Warning, and clang::diag::WarningOrError.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setElideType | ( | bool | Val = true | ) | [inline] |
Set type eliding, to skip outputting same types occurring in template types.
Definition at line 470 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setEnableAllWarnings | ( | bool | Val | ) | [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 445 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setErrorLimit | ( | unsigned | Limit | ) | [inline] |
Specify a limit for the number of errors we should emit before giving up.
Zero disables the limit.
Definition at line 409 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setErrorsAsFatal | ( | bool | Val | ) | [inline] |
When set to true, any error reported is made a fatal error.
Definition at line 453 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setExtensionHandlingBehavior | ( | diag::Severity | H | ) | [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 513 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setIgnoreAllWarnings | ( | bool | Val | ) | [inline] |
When set to true, any unmapped warnings are ignored.
If this and WarningsAsErrors are both set, then this one wins.
Definition at line 438 of file Diagnostic.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::MigrateSourceAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), clang::arcmt::ObjCMigrateAction::BeginInvocation(), and clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setLastDiagnosticIgnored | ( | ) | [inline] |
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed.
This can be used by clients who suppress diagnostics themselves.
Definition at line 496 of file Diagnostic.h.
References clang::DiagnosticIDs::Fatal, and Ignored.
Referenced by clang::Sema::EmitCurrentDiagnostic().
void clang::DiagnosticsEngine::setNumWarnings | ( | unsigned | NumWarnings | ) | [inline] |
Definition at line 587 of file Diagnostic.h.
Referenced by clang::ASTUnit::Reparse().
void clang::DiagnosticsEngine::setPrintTemplateTree | ( | bool | Val = false | ) | [inline] |
Set tree printing, to outputting the template difference in a tree format.
Definition at line 475 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 152 of file Diagnostic.cpp.
References clang::diag::DIAG_UPPER_LIMIT, clang::diag::Error, Error, clang::diag::Fatal, Fatal, clang::DiagnosticMapping::getSeverity(), clang::FullSourceLoc::isBeforeInTranslationUnitThan(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isValid(), and clang::diag::Warning.
Referenced by 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 296 of file Diagnostic.cpp.
References setSeverity().
Referenced by clang::ProcessWarningOptions().
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 220 of file Diagnostic.cpp.
References Diag(), and setSeverity().
Referenced by clang::ProcessWarningOptions(), setDiagnosticGroupErrorAsFatal(), and setDiagnosticGroupWarningAsError().
void clang::DiagnosticsEngine::setShowColors | ( | bool | Val = false | ) | [inline] |
Set color printing, so the type diffing will inject color markers into the output.
Definition at line 480 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setShowOverloads | ( | OverloadsShown | Val | ) | [inline] |
Specify which overload candidates to show when overload resolution fails.
By default, we show all candidates.
Definition at line 487 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setSourceManager | ( | SourceManager * | SrcMgr | ) | [inline] |
Definition at line 381 of file Diagnostic.h.
Referenced by clang::SourceManager::SourceManager().
void clang::DiagnosticsEngine::setSuppressAllDiagnostics | ( | bool | Val = true | ) | [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 463 of file Diagnostic.h.
Referenced by clang::Sema::ActOnOpenMPReductionClause(), clang::Preprocessor::setCodeCompletionReached(), and clang::Sema::tryExprAsCall().
void clang::DiagnosticsEngine::setSuppressSystemWarnings | ( | bool | Val | ) | [inline] |
When set to true mask warnings that come from system headers.
Definition at line 457 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setTemplateBacktraceLimit | ( | unsigned | Limit | ) | [inline] |
Specify the maximum number of template instantiation notes to emit along with a given diagnostic.
Definition at line 413 of file Diagnostic.h.
Referenced by clang::ProcessWarningOptions().
void clang::DiagnosticsEngine::setWarningsAsErrors | ( | bool | Val | ) | [inline] |
When set to true, any warnings reported are issued as errors.
Definition at line 449 of file Diagnostic.h.
Referenced by clang::ento::CreateAnalysisConsumer(), and clang::ProcessWarningOptions().
std::unique_ptr<DiagnosticConsumer> clang::DiagnosticsEngine::takeClient | ( | ) | [inline] |
Return the current diagnostic client along with ownership of that client.
Definition at line 374 of file Diagnostic.h.
Referenced by clang::FixItRewriter::FixItRewriter(), SetUpDiagnosticLog(), SetupSerializedDiagnostics(), and clang::VerifyDiagnosticConsumer::~VerifyDiagnosticConsumer().
friend class ASTReader [friend] |
Definition at line 813 of file Diagnostic.h.
friend class ASTWriter [friend] |
Definition at line 814 of file Diagnostic.h.
friend class Diagnostic [friend] |
Definition at line 720 of file Diagnostic.h.
friend class DiagnosticBuilder [friend] |
Definition at line 719 of file Diagnostic.h.
Referenced by Report().
friend class DiagnosticErrorTrap [friend] |
Definition at line 722 of file Diagnostic.h.
friend class DiagnosticIDs [friend] |
Definition at line 718 of file Diagnostic.h.
friend class PartialDiagnostic [friend] |
Definition at line 721 of file Diagnostic.h.
friend class Sema [friend] |
Definition at line 800 of file Diagnostic.h.