14 #ifndef LLVM_CLANG_BASIC_DIAGNOSTICIDS_H 15 #define LLVM_CLANG_BASIC_DIAGNOSTICIDS_H 18 #include "llvm/ADT/IntrusiveRefCntPtr.h" 19 #include "llvm/ADT/StringRef.h" 23 class DiagnosticsEngine;
63 typedef unsigned kind;
67 #define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ 68 SFINAE,CATEGORY,NOWERROR,SHOWINSYSHEADER) ENUM, 70 #include "clang/Basic/DiagnosticCommonKinds.inc" 101 unsigned IsPragma : 1;
102 unsigned HasNoWarningAsError : 1;
103 unsigned HasNoErrorAsFatal : 1;
104 unsigned WasUpgradedFromWarning : 1;
110 Result.Severity = (unsigned)Severity;
111 Result.IsUser = IsUser;
112 Result.IsPragma = IsPragma;
113 Result.HasNoWarningAsError = 0;
114 Result.HasNoErrorAsFatal = 0;
115 Result.WasUpgradedFromWarning = 0;
144 return (IsUser << 7) | (IsPragma << 6) | (HasNoWarningAsError << 5) |
145 (HasNoErrorAsFatal << 4) | (WasUpgradedFromWarning << 3) |
Severity;
150 Result.IsUser = (Bits >> 7) & 1;
151 Result.IsPragma = (Bits >> 6) & 1;
152 Result.HasNoWarningAsError = (Bits >> 5) & 1;
153 Result.HasNoErrorAsFatal = (Bits >> 4) & 1;
154 Result.WasUpgradedFromWarning = (Bits >> 3) & 1;
155 Result.Severity = Bits & 0x7;
172 std::unique_ptr<diag::CustomDiagInfo> CustomDiagInfo;
187 unsigned getCustomDiagID(
Level L, StringRef FormatString);
194 StringRef getDescription(
unsigned DiagID)
const;
201 static bool isBuiltinWarningOrExtension(
unsigned DiagID);
205 static bool isDefaultMappingAsError(
unsigned DiagID);
208 static bool isBuiltinNote(
unsigned DiagID);
214 return isBuiltinExtensionDiag(DiagID, ignored);
224 static bool isBuiltinExtensionDiag(
unsigned DiagID,
bool &EnabledByDefault);
231 static StringRef getWarningOptionForDiag(
unsigned DiagID);
235 static unsigned getCategoryNumberForDiag(
unsigned DiagID);
238 static unsigned getNumberOfCategories();
241 static StringRef getCategoryNameFromID(
unsigned CategoryID);
245 static bool isARCDiagnostic(
unsigned DiagID);
281 static SFINAEResponse getDiagnosticSFINAEResponse(
unsigned DiagID);
288 static std::vector<std::string> getDiagnosticFlags();
299 std::vector<diag::kind> &Diags);
334 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