class DiagnosticsEngine
Declaration
class DiagnosticsEngine : public RefCountedBase { /* full declaration omitted */ };
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:192
Inherits from: RefCountedBase
Member Variables
- private unsigned char AllExtensionsSilenced = 0
- private bool FatalsAsError = false
- private bool SuppressAllDiagnostics = false
- private bool ElideType = true
- private bool PrintTemplateTree = false
- private bool ShowColors = false
- private clang::OverloadsShown ShowOverloads = Ovl_All
- private unsigned int NumOverloadsToShow = 32
- private unsigned int ErrorLimit = 0
- private unsigned int TemplateBacktraceLimit = 0
- private unsigned int ConstexprBacktraceLimit = 0
- private IntrusiveRefCntPtr<clang::DiagnosticIDs> Diags
- private IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts
- private clang::DiagnosticConsumer* Client = nullptr
- private std::unique_ptr<DiagnosticConsumer> Owner
- private clang::SourceManager* SourceMgr = nullptr
- private std::list<DiagState> DiagStates
- Keeps and automatically disposes all DiagStates that we create.
- private clang::DiagnosticsEngine::DiagStateMap DiagStatesByLoc
- private std::vector<DiagState*> DiagStateOnPushStack
- Keeps the DiagState that was active during each diagnostic 'push' so we can get back at it when we 'pop'.
- private bool ErrorOccurred
- Sticky flag set to \c true when an error is emitted.
- private bool UncompilableErrorOccurred
- Sticky flag set to \c true when an "uncompilable error" occurs. I.e. an error that was not upgraded from a warning by -Werror.
- private bool FatalErrorOccurred
- Sticky flag set to \c true when a fatal error is emitted.
- private bool UnrecoverableErrorOccurred
- Indicates that an unrecoverable error has occurred.
- private unsigned int TrapNumErrorsOccurred
- Counts for DiagnosticErrorTrap to check whether an error occurred during a parsing section, e.g. during parsing a function.
- private unsigned int TrapNumUnrecoverableErrorsOccurred
- private DiagnosticIDs::Level LastDiagLevel
- This is used to emit continuation diagnostics with the same level as the diagnostic that they follow.
- private unsigned int NumWarnings
- Number of warnings reported
- private unsigned int NumErrors
- Number of errors reported
- private void* ArgToStringCookie = nullptr
- private clang::DiagnosticsEngine::ArgToStringFnTy ArgToStringFn
- private unsigned int DelayedDiagID
- ID of the "delayed" diagnostic, which is a (typically fatal) diagnostic that had to be delayed because it was found while emitting another diagnostic.
- private std::string DelayedDiagArg1
- First string argument for the delayed diagnostic.
- private std::string DelayedDiagArg2
- Second string argument for the delayed diagnostic.
- private std::string DelayedDiagArg3
- Third string argument for the delayed diagnostic.
- private std::string FlagValue
- Some flags accept values, for instance: -Wframe-larger-than= <value > and -Rpass= <value >. The content of this string is emitted after the flag name and '='.
- private clang::SourceLocation CurDiagLoc
- The location of the current diagnostic that is in flight.
- private unsigned int CurDiagID
- This is set to std::numeric_limits <unsigned >::max() when there is no diagnostic in flight.
- private clang::DiagnosticStorage DiagStorage
Method Overview
- public void Clear()
- public void ConvertArgToString(clang::DiagnosticsEngine::ArgumentKind Kind, intptr_t Val, llvm::StringRef Modifier, llvm::StringRef Argument, ArrayRef<clang::DiagnosticsEngine::ArgumentValue> PrevArgs, SmallVectorImpl<char> & Output, ArrayRef<intptr_t> QualTypeVals) const
- public void DecrementAllExtensionsSilenced()
- public DiagnosticsEngine(IntrusiveRefCntPtr<clang::DiagnosticIDs> Diags, IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts, clang::DiagnosticConsumer * client = nullptr, bool ShouldOwnClient = true)
- public DiagnosticsEngine(const clang::DiagnosticsEngine &)
- protected bool EmitCurrentDiagnostic(bool Force = false)
- private clang::DiagnosticsEngine::DiagState * GetCurDiagState() const
- private clang::DiagnosticsEngine::DiagState * GetDiagStateForLoc(clang::SourceLocation Loc) const
- public void IncrementAllExtensionsSilenced()
- private bool ProcessDiag()
- private void PushDiagStatePoint(clang::DiagnosticsEngine::DiagState * State, clang::SourceLocation L)
- public void Report(const clang::StoredDiagnostic & storedDiag)
- public inline clang::DiagnosticBuilder Report(unsigned int DiagID)
- public inline clang::DiagnosticBuilder Report(clang::SourceLocation Loc, unsigned int DiagID)
- private void ReportDelayed()
- public void Reset(bool soft = false)
- public void SetArgToStringFn(clang::DiagnosticsEngine::ArgToStringFnTy Fn, void * Cookie)
- public void SetDelayedDiagnostic(unsigned int DiagID, llvm::StringRef Arg1 = "", llvm::StringRef Arg2 = "", llvm::StringRef Arg3 = "")
- public void dump(llvm::StringRef DiagName) const
- public void dump() const
- public clang::DiagnosticConsumer * getClient()
- public const clang::DiagnosticConsumer * getClient() const
- public unsigned int getConstexprBacktraceLimit() const
- protected unsigned int getCurrentDiagID() const
- protected clang::SourceLocation getCurrentDiagLoc() const
- public template <unsigned int N>unsigned int getCustomDiagID(clang::DiagnosticsEngine::Level L, const char (&)[N] FormatString)
- public const IntrusiveRefCntPtr<clang::DiagnosticIDs> & getDiagnosticIDs() const
- public clang::DiagnosticsEngine::Level getDiagnosticLevel(unsigned int DiagID, clang::SourceLocation Loc) const
- public clang::DiagnosticsEngine::diag_mapping_range getDiagnosticMappings() const
- public clang::DiagnosticOptions & getDiagnosticOptions() const
- public bool getElideType()
- public bool getEnableAllWarnings() const
- public bool getErrorsAsFatal() const
- public diag::Severity getExtensionHandlingBehavior() const
- public bool getFatalsAsError() const
- public llvm::StringRef getFlagValue() const
- public bool getIgnoreAllWarnings() const
- public unsigned int getNumErrors() const
- public unsigned int getNumOverloadCandidatesToShow() const
- public unsigned int getNumWarnings() const
- public bool getPrintTemplateTree()
- public bool getShowColors()
- public clang::OverloadsShown getShowOverloads() const
- public clang::SourceManager & getSourceManager() const
- public bool getSuppressAllDiagnostics() const
- public bool getSuppressSystemWarnings() const
- public unsigned int getTemplateBacktraceLimit() const
- public bool getWarningsAsErrors() const
- public bool hasAllExtensionsSilenced()
- public bool hasErrorOccurred() const
- public bool hasFatalErrorOccurred() const
- public bool hasSourceManager() const
- public bool hasUncompilableErrorOccurred() const
- public bool hasUnrecoverableErrorOccurred() const
- public bool isDiagnosticInFlight() const
- public bool isIgnored(unsigned int DiagID, clang::SourceLocation Loc) const
- public bool isLastDiagnosticIgnored() const
- private clang::DiagnosticMapping makeUserMapping(diag::Severity Map, clang::SourceLocation L)
- public void notePriorDiagnosticFrom(const clang::DiagnosticsEngine & Other)
- public void overloadCandidatesShown(unsigned int N)
- public bool ownsClient() const
- public bool popMappings(clang::SourceLocation Loc)
- public void pushMappings(clang::SourceLocation Loc)
- public void setClient(clang::DiagnosticConsumer * client, bool ShouldOwnClient = true)
- public void setConstexprBacktraceLimit(unsigned int Limit)
- public bool setDiagnosticGroupErrorAsFatal(llvm::StringRef Group, bool Enabled)
- public bool setDiagnosticGroupWarningAsError(llvm::StringRef Group, bool Enabled)
- public void setElideType(bool Val)
- public void setEnableAllWarnings(bool Val)
- public void setErrorLimit(unsigned int Limit)
- public void setErrorsAsFatal(bool Val)
- public void setExtensionHandlingBehavior(diag::Severity H)
- public void setFatalsAsError(bool Val)
- public void setIgnoreAllWarnings(bool Val)
- public void setLastDiagnosticIgnored(bool Ignored)
- public void setNumWarnings(unsigned int NumWarnings)
- public void setPrintTemplateTree(bool Val)
- public void setSeverity(diag::kind Diag, diag::Severity Map, clang::SourceLocation Loc)
- public void setSeverityForAll(diag::Flavor Flavor, diag::Severity Map, clang::SourceLocation Loc = clang::SourceLocation())
- public bool setSeverityForGroup(diag::Flavor Flavor, llvm::StringRef Group, diag::Severity Map, clang::SourceLocation Loc = clang::SourceLocation())
- public bool setSeverityForGroup(diag::Flavor Flavor, diag::Group Group, diag::Severity Map, clang::SourceLocation Loc = clang::SourceLocation())
- public void setShowColors(bool Val)
- public void setShowOverloads(clang::OverloadsShown Val)
- public void setSourceManager(clang::SourceManager * SrcMgr)
- public void setSuppressAllDiagnostics(bool Val)
- public void setSuppressSystemWarnings(bool Val)
- public void setTemplateBacktraceLimit(unsigned int Limit)
- public void setWarningsAsErrors(bool Val)
- public std::unique_ptr<DiagnosticConsumer> takeClient()
- public ~DiagnosticsEngine()
Methods
¶void Clear()
void Clear()
Description
Clear out the current diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:977
¶void ConvertArgToString(
clang::DiagnosticsEngine::ArgumentKind Kind,
intptr_t Val,
llvm::StringRef Modifier,
llvm::StringRef Argument,
ArrayRef<
clang::DiagnosticsEngine::ArgumentValue>
PrevArgs,
SmallVectorImpl<char>& Output,
ArrayRef<intptr_t> QualTypeVals) const
void ConvertArgToString(
clang::DiagnosticsEngine::ArgumentKind Kind,
intptr_t Val,
llvm::StringRef Modifier,
llvm::StringRef Argument,
ArrayRef<
clang::DiagnosticsEngine::ArgumentValue>
PrevArgs,
SmallVectorImpl<char>& Output,
ArrayRef<intptr_t> QualTypeVals) const
Description
Converts a diagnostic argument (as an intptr_t) into the string that represents it.
Declared at: clang/include/clang/Basic/Diagnostic.h:875
Parameters
- clang::DiagnosticsEngine::ArgumentKind Kind
- intptr_t Val
- llvm::StringRef Modifier
- llvm::StringRef Argument
- ArrayRef<clang::DiagnosticsEngine::ArgumentValue> PrevArgs
- SmallVectorImpl<char>& Output
- ArrayRef<intptr_t> QualTypeVals
¶void DecrementAllExtensionsSilenced()
void DecrementAllExtensionsSilenced()
Declared at: clang/include/clang/Basic/Diagnostic.h:785
¶DiagnosticsEngine(
IntrusiveRefCntPtr<clang::DiagnosticIDs>
Diags,
IntrusiveRefCntPtr<clang::DiagnosticOptions>
DiagOpts,
clang::DiagnosticConsumer* client = nullptr,
bool ShouldOwnClient = true)
DiagnosticsEngine(
IntrusiveRefCntPtr<clang::DiagnosticIDs>
Diags,
IntrusiveRefCntPtr<clang::DiagnosticOptions>
DiagOpts,
clang::DiagnosticConsumer* client = nullptr,
bool ShouldOwnClient = true)
Declared at: clang/include/clang/Basic/Diagnostic.h:540
Parameters
- IntrusiveRefCntPtr<clang::DiagnosticIDs> Diags
- IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts
- clang::DiagnosticConsumer* client = nullptr
- bool ShouldOwnClient = true
¶DiagnosticsEngine(const clang::DiagnosticsEngine&)
DiagnosticsEngine(const clang::DiagnosticsEngine&)
Declared at: clang/include/clang/Basic/Diagnostic.h:544
Parameters
- const clang::DiagnosticsEngine&
¶bool EmitCurrentDiagnostic(bool Force = false)
bool EmitCurrentDiagnostic(bool Force = false)
Description
Emit the current diagnostic and clear the diagnostic state.
Declared at: clang/include/clang/Basic/Diagnostic.h:1055
Parameters
- bool Force = false
- Emit the diagnostic regardless of suppression settings.
¶clang::DiagnosticsEngine::DiagState*
GetCurDiagState() const
clang::DiagnosticsEngine::DiagState*
GetCurDiagState() const
Declared at: clang/include/clang/Basic/Diagnostic.h:454
¶clang::DiagnosticsEngine::DiagState*
GetDiagStateForLoc(
clang::SourceLocation Loc) const
clang::DiagnosticsEngine::DiagState*
GetDiagStateForLoc(
clang::SourceLocation Loc) const
Description
Finds the DiagStatePoint that contains the diagnostic state of the given source location.
Declared at: clang/include/clang/Basic/Diagnostic.h:462
Parameters
¶void IncrementAllExtensionsSilenced()
void IncrementAllExtensionsSilenced()
Description
Counter bumped when an __extension__ block is/ encountered. When non-zero, all extension diagnostics are entirely silenced, no matter how they are mapped.
Declared at: clang/include/clang/Basic/Diagnostic.h:784
¶bool ProcessDiag()
bool ProcessDiag()
Description
Used to report a diagnostic that is finally fully formed.
Declared at: clang/include/clang/Basic/Diagnostic.h:1036
Returns
true if the diagnostic was emitted, false if it was suppressed.
¶void PushDiagStatePoint(
clang::DiagnosticsEngine::DiagState* State,
clang::SourceLocation L)
void PushDiagStatePoint(
clang::DiagnosticsEngine::DiagState* State,
clang::SourceLocation L)
Declared at: clang/include/clang/Basic/Diagnostic.h:458
Parameters
¶void Report(
const clang::StoredDiagnostic& storedDiag)
void Report(
const clang::StoredDiagnostic& storedDiag)
Declared at: clang/include/clang/Basic/Diagnostic.h:941
Parameters
- const clang::StoredDiagnostic& storedDiag
¶inline clang::DiagnosticBuilder Report(
unsigned int DiagID)
inline clang::DiagnosticBuilder Report(
unsigned int DiagID)
Declared at: clang/include/clang/Basic/Diagnostic.h:939
Parameters
- unsigned int DiagID
¶inline clang::DiagnosticBuilder Report(
clang::SourceLocation Loc,
unsigned int DiagID)
inline clang::DiagnosticBuilder Report(
clang::SourceLocation Loc,
unsigned int DiagID)
Description
Issue the message to the client. This actually returns an instance of DiagnosticBuilder which emits the diagnostics (through @c ProcessDiag) when it is destroyed.
Declared at: clang/include/clang/Basic/Diagnostic.h:938
Parameters
- clang::SourceLocation Loc
- Represents the source location associated with the diagnostic, which can be an invalid location if no position information is available.
- unsigned int DiagID
- A member of the @c diag::kind enum.
¶void ReportDelayed()
void ReportDelayed()
Description
Report the delayed diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:996
¶void Reset(bool soft = false)
void Reset(bool soft = false)
Description
Reset the state of the diagnostic object to its initial configuration.
Declared at: clang/include/clang/Basic/Diagnostic.h:897
Parameters
- bool soft = false
- - if true, doesn't reset the diagnostic mappings and state
¶void SetArgToStringFn(
clang::DiagnosticsEngine::ArgToStringFnTy Fn,
void* Cookie)
void SetArgToStringFn(
clang::DiagnosticsEngine::ArgToStringFnTy Fn,
void* Cookie)
Declared at: clang/include/clang/Basic/Diagnostic.h:884
Parameters
- clang::DiagnosticsEngine::ArgToStringFnTy Fn
- void* Cookie
¶void SetDelayedDiagnostic(
unsigned int DiagID,
llvm::StringRef Arg1 = "",
llvm::StringRef Arg2 = "",
llvm::StringRef Arg3 = "")
void SetDelayedDiagnostic(
unsigned int DiagID,
llvm::StringRef Arg1 = "",
llvm::StringRef Arg2 = "",
llvm::StringRef Arg3 = "")
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:973
Parameters
- unsigned int DiagID
- The ID of the diagnostic being delayed.
- llvm::StringRef Arg1 = ""
- A string argument that will be provided to the diagnostic. A copy of this string will be stored in the DiagnosticsEngine object itself.
- llvm::StringRef Arg2 = ""
- A string argument that will be provided to the diagnostic. A copy of this string will be stored in the DiagnosticsEngine object itself.
- llvm::StringRef Arg3 = ""
- A string argument that will be provided to the diagnostic. A copy of this string will be stored in the DiagnosticsEngine object itself.
¶void dump(llvm::StringRef DiagName) const
void dump(llvm::StringRef DiagName) const
Declared at: clang/include/clang/Basic/Diagnostic.h:550
Parameters
- llvm::StringRef DiagName
¶void dump() const
void dump() const
Declared at: clang/include/clang/Basic/Diagnostic.h:549
¶clang::DiagnosticConsumer* getClient()
clang::DiagnosticConsumer* getClient()
Declared at: clang/include/clang/Basic/Diagnostic.h:567
¶const clang::DiagnosticConsumer* getClient() const
const clang::DiagnosticConsumer* getClient() const
Declared at: clang/include/clang/Basic/Diagnostic.h:568
¶unsigned int getConstexprBacktraceLimit() const
unsigned int getConstexprBacktraceLimit() const
Description
Retrieve the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:638
¶unsigned int getCurrentDiagID() const
unsigned int getCurrentDiagID() const
Declared at: clang/include/clang/Basic/Diagnostic.h:1057
¶clang::SourceLocation getCurrentDiagLoc() const
clang::SourceLocation getCurrentDiagLoc() const
Declared at: clang/include/clang/Basic/Diagnostic.h:1059
¶template <unsigned int N>
unsigned int getCustomDiagID(
clang::DiagnosticsEngine::Level L,
const char (&)[N] FormatString)
template <unsigned int N>
unsigned int getCustomDiagID(
clang::DiagnosticsEngine::Level L,
const char (&)[N] FormatString)
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:868
Templates
- unsigned int N
Parameters
- clang::DiagnosticsEngine::Level L
- const char (&)[N] FormatString
- A fixed diagnostic format string that will be hashed and mapped to a unique DiagID.
¶const IntrusiveRefCntPtr<clang::DiagnosticIDs>&
getDiagnosticIDs() const
const IntrusiveRefCntPtr<clang::DiagnosticIDs>&
getDiagnosticIDs() const
Declared at: clang/include/clang/Basic/Diagnostic.h:552
¶clang::DiagnosticsEngine::Level
getDiagnosticLevel(
unsigned int DiagID,
clang::SourceLocation Loc) const
clang::DiagnosticsEngine::Level
getDiagnosticLevel(
unsigned int DiagID,
clang::SourceLocation Loc) const
Description
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\c isIgnored().
Declared at: clang/include/clang/Basic/Diagnostic.h:926
Parameters
- unsigned int DiagID
- clang::SourceLocation Loc
- The source location we are interested in finding out the diagnostic state. Can be null in order to query the latest state.
¶clang::DiagnosticsEngine::diag_mapping_range
getDiagnosticMappings() const
clang::DiagnosticsEngine::diag_mapping_range
getDiagnosticMappings() const
Description
Get the current set of diagnostic mappings.
Declared at: clang/include/clang/Basic/Diagnostic.h:562
¶clang::DiagnosticOptions& getDiagnosticOptions()
const
clang::DiagnosticOptions& getDiagnosticOptions()
const
Description
Retrieve the diagnostic options.
Declared at: clang/include/clang/Basic/Diagnostic.h:557
¶bool getElideType()
bool getElideType()
Declared at: clang/include/clang/Basic/Diagnostic.h:698
¶bool getEnableAllWarnings() const
bool getEnableAllWarnings() const
Declared at: clang/include/clang/Basic/Diagnostic.h:659
¶bool getErrorsAsFatal() const
bool getErrorsAsFatal() const
Declared at: clang/include/clang/Basic/Diagnostic.h:673
¶diag::Severity getExtensionHandlingBehavior()
const
diag::Severity getExtensionHandlingBehavior()
const
Declared at: clang/include/clang/Basic/Diagnostic.h:776
¶bool getFatalsAsError() const
bool getFatalsAsError() const
Declared at: clang/include/clang/Basic/Diagnostic.h:679
¶llvm::StringRef getFlagValue() const
llvm::StringRef getFlagValue() const
Description
Return the value associated with this diagnostic flag.
Declared at: clang/include/clang/Basic/Diagnostic.h:980
¶bool getIgnoreAllWarnings() const
bool getIgnoreAllWarnings() const
Declared at: clang/include/clang/Basic/Diagnostic.h:648
¶unsigned int getNumErrors() const
unsigned int getNumErrors() const
Declared at: clang/include/clang/Basic/Diagnostic.h:852
¶unsigned int getNumOverloadCandidatesToShow()
const
unsigned int getNumOverloadCandidatesToShow()
const
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:726
¶unsigned int getNumWarnings() const
unsigned int getNumWarnings() const
Declared at: clang/include/clang/Basic/Diagnostic.h:853
¶bool getPrintTemplateTree()
bool getPrintTemplateTree()
Declared at: clang/include/clang/Basic/Diagnostic.h:703
¶bool getShowColors()
bool getShowColors()
Declared at: clang/include/clang/Basic/Diagnostic.h:708
¶clang::OverloadsShown getShowOverloads() const
clang::OverloadsShown getShowOverloads() const
Declared at: clang/include/clang/Basic/Diagnostic.h:717
¶clang::SourceManager& getSourceManager() const
clang::SourceManager& getSourceManager() const
Declared at: clang/include/clang/Basic/Diagnostic.h:579
¶bool getSuppressAllDiagnostics() const
bool getSuppressAllDiagnostics() const
Declared at: clang/include/clang/Basic/Diagnostic.h:693
¶bool getSuppressSystemWarnings() const
bool getSuppressSystemWarnings() const
Declared at: clang/include/clang/Basic/Diagnostic.h:685
¶unsigned int getTemplateBacktraceLimit() const
unsigned int getTemplateBacktraceLimit() const
Description
Retrieve the maximum number of template instantiation notes to emit along with a given diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:626
¶bool getWarningsAsErrors() const
bool getWarningsAsErrors() const
Declared at: clang/include/clang/Basic/Diagnostic.h:667
¶bool hasAllExtensionsSilenced()
bool hasAllExtensionsSilenced()
Declared at: clang/include/clang/Basic/Diagnostic.h:786
¶bool hasErrorOccurred() const
bool hasErrorOccurred() const
Declared at: clang/include/clang/Basic/Diagnostic.h:838
¶bool hasFatalErrorOccurred() const
bool hasFatalErrorOccurred() const
Declared at: clang/include/clang/Basic/Diagnostic.h:845
¶bool hasSourceManager() const
bool hasSourceManager() const
Declared at: clang/include/clang/Basic/Diagnostic.h:577
¶bool hasUncompilableErrorOccurred() const
bool hasUncompilableErrorOccurred() const
Description
Errors that actually prevent compilation, not those that are upgraded from a warning by -Werror.
Declared at: clang/include/clang/Basic/Diagnostic.h:842
¶bool hasUnrecoverableErrorOccurred() const
bool hasUnrecoverableErrorOccurred() const
Description
Determine whether any kind of unrecoverable error has occurred.
Declared at: clang/include/clang/Basic/Diagnostic.h:848
¶bool isDiagnosticInFlight() const
bool isDiagnosticInFlight() const
Description
Determine whethere there is already a diagnostic in flight.
Declared at: clang/include/clang/Basic/Diagnostic.h:944
¶bool isIgnored(unsigned int DiagID,
clang::SourceLocation Loc) const
bool isIgnored(unsigned int DiagID,
clang::SourceLocation Loc) const
Description
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 \p Loc.
Declared at: clang/include/clang/Basic/Diagnostic.h:911
Parameters
- unsigned int DiagID
- clang::SourceLocation Loc
- The source location we are interested in finding out the diagnostic state. Can be null in order to query the latest state.
¶bool isLastDiagnosticIgnored() const
bool isLastDiagnosticIgnored() const
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:765
¶clang::DiagnosticMapping makeUserMapping(
diag::Severity Map,
clang::SourceLocation L)
clang::DiagnosticMapping makeUserMapping(
diag::Severity Map,
clang::SourceLocation L)
Declared at: clang/include/clang/Basic/Diagnostic.h:1018
Parameters
- diag::Severity Map
- clang::SourceLocation L
¶void notePriorDiagnosticFrom(
const clang::DiagnosticsEngine& Other)
void notePriorDiagnosticFrom(
const clang::DiagnosticsEngine& Other)
Description
Note that the prior diagnostic was emitted by some other\c DiagnosticsEngine, and we may be attaching a note to that diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:891
Parameters
- const clang::DiagnosticsEngine& Other
¶void overloadCandidatesShown(unsigned int N)
void overloadCandidatesShown(unsigned int N)
Description
Call this after showing N overload candidates. This influences the value returned by later calls to getNumOverloadCandidatesToShow().
Declared at: clang/include/clang/Basic/Diagnostic.h:741
Parameters
- unsigned int N
¶bool ownsClient() const
bool ownsClient() const
Description
Determine whether this \c DiagnosticsEngine object own its client.
Declared at: clang/include/clang/Basic/Diagnostic.h:571
¶bool popMappings(clang::SourceLocation Loc)
bool popMappings(clang::SourceLocation Loc)
Description
Pops the current DiagMappings off the top of the stack, causing the new top of the stack to be the active mappings.
Declared at: clang/include/clang/Basic/Diagnostic.h:604
Parameters
Returns
\c true if the pop happens, \c false if there is only one DiagMapping on the stack.
¶void pushMappings(clang::SourceLocation Loc)
void pushMappings(clang::SourceLocation Loc)
Description
Copies the current DiagMappings and pushes the new copy onto the top of the stack.
Declared at: clang/include/clang/Basic/Diagnostic.h:597
Parameters
¶void setClient(clang::DiagnosticConsumer* client,
bool ShouldOwnClient = true)
void setClient(clang::DiagnosticConsumer* client,
bool ShouldOwnClient = true)
Description
Set the diagnostic client associated with this diagnostic object.
Declared at: clang/include/clang/Basic/Diagnostic.h:610
Parameters
- clang::DiagnosticConsumer* client
- bool ShouldOwnClient = true
- true if the diagnostic object should take ownership of \c client.
¶void setConstexprBacktraceLimit(
unsigned int Limit)
void setConstexprBacktraceLimit(
unsigned int Limit)
Description
Specify the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:632
Parameters
- unsigned int Limit
¶bool setDiagnosticGroupErrorAsFatal(
llvm::StringRef Group,
bool Enabled)
bool setDiagnosticGroupErrorAsFatal(
llvm::StringRef Group,
bool Enabled)
Description
Set the error-as-fatal flag for the given diagnostic group. This function always only operates on the current diagnostic state.
Declared at: clang/include/clang/Basic/Diagnostic.h:828
Parameters
- llvm::StringRef Group
- bool Enabled
Returns
True if the given group is unknown, false otherwise.
¶bool setDiagnosticGroupWarningAsError(
llvm::StringRef Group,
bool Enabled)
bool setDiagnosticGroupWarningAsError(
llvm::StringRef Group,
bool Enabled)
Description
Set the warning-as-error flag for the given diagnostic group. This function always only operates on the current diagnostic state.
Declared at: clang/include/clang/Basic/Diagnostic.h:821
Parameters
- llvm::StringRef Group
- bool Enabled
Returns
True if the given group is unknown, false otherwise.
¶void setElideType(bool Val)
void setElideType(bool Val)
Description
Set type eliding, to skip outputting same types occurring in template types.
Declared at: clang/include/clang/Basic/Diagnostic.h:697
Parameters
- bool Val
¶void setEnableAllWarnings(bool Val)
void setEnableAllWarnings(bool Val)
Description
When set to true, any unmapped ignored warnings are no longer ignored. If this and IgnoreAllWarnings are both set, then that one wins.
Declared at: clang/include/clang/Basic/Diagnostic.h:656
Parameters
- bool Val
¶void setErrorLimit(unsigned int Limit)
void setErrorLimit(unsigned int Limit)
Description
Specify a limit for the number of errors we should emit before giving up. Zero disables the limit.
Declared at: clang/include/clang/Basic/Diagnostic.h:616
Parameters
- unsigned int Limit
¶void setErrorsAsFatal(bool Val)
void setErrorsAsFatal(bool Val)
Description
When set to true, any error reported is made a fatal error.
Declared at: clang/include/clang/Basic/Diagnostic.h:672
Parameters
- bool Val
¶void setExtensionHandlingBehavior(
diag::Severity H)
void setExtensionHandlingBehavior(
diag::Severity H)
Description
Controls whether otherwise-unmapped extension diagnostics are mapped onto ignore/warning/error. This corresponds to the GCC -pedantic and -pedantic-errors option.
Declared at: clang/include/clang/Basic/Diagnostic.h:773
Parameters
- diag::Severity H
¶void setFatalsAsError(bool Val)
void setFatalsAsError(bool Val)
Description
When set to true, any fatal error reported is made an error.
This setting takes precedence over the setErrorsAsFatal setting above.
Declared at: clang/include/clang/Basic/Diagnostic.h:678
Parameters
- bool Val
¶void setIgnoreAllWarnings(bool Val)
void setIgnoreAllWarnings(bool Val)
Description
When set to true, any unmapped warnings are ignored. If this and WarningsAsErrors are both set, then this one wins.
Declared at: clang/include/clang/Basic/Diagnostic.h:645
Parameters
- bool Val
¶void setLastDiagnosticIgnored(bool Ignored)
void setLastDiagnosticIgnored(bool Ignored)
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:756
Parameters
- bool Ignored
¶void setNumWarnings(unsigned int NumWarnings)
void setNumWarnings(unsigned int NumWarnings)
Declared at: clang/include/clang/Basic/Diagnostic.h:855
Parameters
- unsigned int NumWarnings
¶void setPrintTemplateTree(bool Val)
void setPrintTemplateTree(bool Val)
Description
Set tree printing, to outputting the template difference in a tree format.
Declared at: clang/include/clang/Basic/Diagnostic.h:702
Parameters
- bool Val
¶void setSeverity(diag::kind Diag,
diag::Severity Map,
clang::SourceLocation Loc)
void setSeverity(diag::kind Diag,
diag::Severity Map,
clang::SourceLocation Loc)
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:796
Parameters
- diag::kind Diag
- diag::Severity Map
- clang::SourceLocation Loc
- The source location that this change of diagnostic state should take affect. It can be null if we are setting the latest state.
¶void setSeverityForAll(
diag::Flavor Flavor,
diag::Severity Map,
clang::SourceLocation Loc =
clang::SourceLocation())
void setSeverityForAll(
diag::Flavor Flavor,
diag::Severity Map,
clang::SourceLocation Loc =
clang::SourceLocation())
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:835
Parameters
- diag::Flavor Flavor
- diag::Severity Map
- clang::SourceLocation Loc = clang::SourceLocation()
¶bool setSeverityForGroup(
diag::Flavor Flavor,
llvm::StringRef Group,
diag::Severity Map,
clang::SourceLocation Loc =
clang::SourceLocation())
bool setSeverityForGroup(
diag::Flavor Flavor,
llvm::StringRef Group,
diag::Severity Map,
clang::SourceLocation Loc =
clang::SourceLocation())
Description
Change an entire diagnostic group (e.g. "unknown-pragmas") to have the specified mapping.
Declared at: clang/include/clang/Basic/Diagnostic.h:809
Parameters
- diag::Flavor Flavor
- The flavor of group to affect. -Rfoo does not affect the state of the -Wfoo group and vice versa.
- llvm::StringRef Group
- diag::Severity Map
- clang::SourceLocation Loc = clang::SourceLocation()
- 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.
Returns
true (and ignores the request) if "Group" was unknown, false otherwise.
¶bool setSeverityForGroup(
diag::Flavor Flavor,
diag::Group Group,
diag::Severity Map,
clang::SourceLocation Loc =
clang::SourceLocation())
bool setSeverityForGroup(
diag::Flavor Flavor,
diag::Group Group,
diag::Severity Map,
clang::SourceLocation Loc =
clang::SourceLocation())
Declared at: clang/include/clang/Basic/Diagnostic.h:812
Parameters
- diag::Flavor Flavor
- diag::Group Group
- diag::Severity Map
- clang::SourceLocation Loc = clang::SourceLocation()
¶void setShowColors(bool Val)
void setShowColors(bool Val)
Description
Set color printing, so the type diffing will inject color markers into the output.
Declared at: clang/include/clang/Basic/Diagnostic.h:707
Parameters
- bool Val
¶void setShowOverloads(clang::OverloadsShown Val)
void setShowOverloads(clang::OverloadsShown Val)
Description
Specify which overload candidates to show when overload resolution fails. By default, we show all candidates.
Declared at: clang/include/clang/Basic/Diagnostic.h:714
Parameters
- clang::OverloadsShown Val
¶void setSourceManager(
clang::SourceManager* SrcMgr)
void setSourceManager(
clang::SourceManager* SrcMgr)
Declared at: clang/include/clang/Basic/Diagnostic.h:584
Parameters
- clang::SourceManager* SrcMgr
¶void setSuppressAllDiagnostics(bool Val)
void setSuppressAllDiagnostics(bool Val)
Description
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
Declared at: clang/include/clang/Basic/Diagnostic.h:692
Parameters
- bool Val
¶void setSuppressSystemWarnings(bool Val)
void setSuppressSystemWarnings(bool Val)
Description
When set to true mask warnings that come from system headers.
Declared at: clang/include/clang/Basic/Diagnostic.h:682
Parameters
- bool Val
¶void setTemplateBacktraceLimit(unsigned int Limit)
void setTemplateBacktraceLimit(unsigned int Limit)
Description
Specify the maximum number of template instantiation notes to emit along with a given diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:620
Parameters
- unsigned int Limit
¶void setWarningsAsErrors(bool Val)
void setWarningsAsErrors(bool Val)
Description
When set to true, any warnings reported are issued as errors.
Declared at: clang/include/clang/Basic/Diagnostic.h:664
Parameters
- bool Val
¶std::unique_ptr<DiagnosticConsumer> takeClient()
std::unique_ptr<DiagnosticConsumer> takeClient()
Description
Return the current diagnostic client along with ownership of that client.
Declared at: clang/include/clang/Basic/Diagnostic.h:575
¶~DiagnosticsEngine()
~DiagnosticsEngine()
Declared at: clang/include/clang/Basic/Diagnostic.h:546