15 #ifndef LLVM_CLANG_BASIC_DIAGNOSTICIDS_H 16 #define LLVM_CLANG_BASIC_DIAGNOSTICIDS_H 19 #include "llvm/ADT/IntrusiveRefCntPtr.h" 20 #include "llvm/ADT/StringRef.h" 24 class DiagnosticsEngine;
64 typedef unsigned kind;
68 #define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ 69 SFINAE,CATEGORY,NOWERROR,SHOWINSYSHEADER) ENUM, 71 #include "clang/Basic/DiagnosticCommonKinds.inc" 102 unsigned IsPragma : 1;
103 unsigned HasNoWarningAsError : 1;
104 unsigned HasNoErrorAsFatal : 1;
105 unsigned WasUpgradedFromWarning : 1;
111 Result.Severity = (unsigned)Severity;
112 Result.IsUser = IsUser;
113 Result.IsPragma = IsPragma;
114 Result.HasNoWarningAsError = 0;
115 Result.HasNoErrorAsFatal = 0;
116 Result.WasUpgradedFromWarning = 0;
145 return (IsUser << 7) | (IsPragma << 6) | (HasNoWarningAsError << 5) |
146 (HasNoErrorAsFatal << 4) | (WasUpgradedFromWarning << 3) |
Severity;
151 Result.IsUser = (Bits >> 7) & 1;
152 Result.IsPragma = (Bits >> 6) & 1;
153 Result.HasNoWarningAsError = (Bits >> 5) & 1;
154 Result.HasNoErrorAsFatal = (Bits >> 4) & 1;
155 Result.WasUpgradedFromWarning = (Bits >> 3) & 1;
156 Result.Severity = Bits & 0x7;
188 unsigned getCustomDiagID(
Level L, StringRef FormatString);
195 StringRef getDescription(
unsigned DiagID)
const;
202 static bool isBuiltinWarningOrExtension(
unsigned DiagID);
206 static bool isDefaultMappingAsError(
unsigned DiagID);
209 static bool isBuiltinNote(
unsigned DiagID);
215 return isBuiltinExtensionDiag(DiagID, ignored);
225 static bool isBuiltinExtensionDiag(
unsigned DiagID,
bool &EnabledByDefault);
232 static StringRef getWarningOptionForDiag(
unsigned DiagID);
236 static unsigned getCategoryNumberForDiag(
unsigned DiagID);
239 static unsigned getNumberOfCategories();
242 static StringRef getCategoryNameFromID(
unsigned CategoryID);
246 static bool isARCDiagnostic(
unsigned DiagID);
282 static SFINAEResponse getDiagnosticSFINAEResponse(
unsigned DiagID);
289 static std::vector<std::string> getDiagnosticFlags();
300 std::vector<diag::kind> &Diags);
335 bool isUnrecoverable(
unsigned DiagID)
const;
A diagnostic that indicates a problem or potential problem.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
The diagnostic should not be reported, but it should cause template argument deduction to fail...
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing)...
static bool getDiagnosticsInGroup(diag::Flavor Flavor, const WarningOption *Group, SmallVectorImpl< diag::kind > &Diags)
Return true if any diagnostics were found in this group, even if they were filtered out due to having...
bool hasNoErrorAsFatal() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Concrete class used by the front-end to report problems and issues.
diag::Severity getSeverity() const
Present this diagnostic as an error.
bool isErrorOrFatal() const
static bool isBuiltinExtensionDiag(unsigned DiagID)
Determine whether the given built-in diagnostic ID is for an extension of some sort.
bool wasUpgradedFromWarning() const
Whether this mapping attempted to map the diagnostic to a warning, but was overruled because the diag...
unsigned serialize() const
Serialize this mapping as a raw integer.
Encodes a location in the source.
void setUpgradedFromWarning(bool Value)
void setNoErrorAsFatal(bool Value)
The diagnostic should be suppressed entirely.
Flavor
Flavors of diagnostics we can emit.
static DiagnosticMapping Make(diag::Severity Severity, bool IsUser, bool IsPragma)
Dataflow Directional Tag Classes.
Present this diagnostic as a remark.
Level
The level of the diagnostic, after it has been through mapping.
Used for handling and querying diagnostic IDs.
void setSeverity(diag::Severity Value)
SFINAEResponse
Enumeration describing how the emission of a diagnostic should be treated when it occurs during C++ t...
static DiagnosticMapping deserialize(unsigned Bits)
Deserialize a mapping.
Do not present this diagnostic, ignore it.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
The diagnostic should be reported.
Present this diagnostic as a fatal error.
void setNoWarningAsError(bool Value)
Present this diagnostic as a warning.
bool hasNoWarningAsError() const