38 Diags.
Report(diag::warn_unknown_diag_option)
39 << (Flavor == diag::Flavor::WarningOrError ? 0 : 1)
40 << (Prefix.str() += std::string(Opt)) << !Suggestion.empty()
41 << (Prefix.str() += std::string(Suggestion));
58 if (Opts.TemplateBacktraceLimit)
60 if (Opts.ConstexprBacktraceLimit)
66 if (Opts.PedanticErrors)
68 else if (Opts.Pedantic)
80 for (
unsigned Report = 0, ReportEnd = 2; Report != ReportEnd; ++Report) {
81 bool SetDiagnostic = (Report == 0);
85 if (!SetDiagnostic && !ReportDiags)
88 for (
unsigned i = 0, e = Opts.
Warnings.size(); i != e; ++i) {
89 const auto Flavor = diag::Flavor::WarningOrError;
91 StringRef OrigOpt = Opts.
Warnings[i];
94 if (Opt ==
"format=0")
99 bool isPositive = !Opt.consume_front(
"no-");
104 isPositive ? diag::Severity::Warning : diag::Severity::Ignored;
108 if (Opt ==
"system-headers") {
116 if (Opt ==
"everything") {
132 if (Opt.starts_with(
"error")) {
134 if (Opt.size() > 5) {
136 Opt.substr(5) !=
"-implicit-function-declaration") {
138 Diags.
Report(diag::warn_unknown_warning_specifier)
139 <<
"-Werror" << (
"-W" + OrigOpt.str());
154 }
else if (DiagIDs->getDiagnosticsInGroup(Flavor,
Specifier, _Diags)) {
161 if (Opt.starts_with(
"fatal-errors")) {
163 if (Opt.size() != 12) {
164 if ((Opt[12] !=
'=' && Opt[12] !=
'-') || Opt.size() == 13) {
166 Diags.
Report(diag::warn_unknown_warning_specifier)
167 <<
"-Wfatal-errors" << (
"-W" + OrigOpt.str());
182 }
else if (DiagIDs->getDiagnosticsInGroup(Flavor,
Specifier, _Diags)) {
189 if (DiagIDs->getDiagnosticsInGroup(Flavor, Opt, _Diags))
197 for (StringRef Opt : Opts.
Remarks) {
198 const auto Flavor = diag::Flavor::Remark;
202 bool IsPositive = !Opt.consume_front(
"no-");
204 auto Severity = IsPositive ? diag::Severity::Remark
205 : diag::Severity::Ignored;
210 if (Opt ==
"everything") {
217 if (DiagIDs->getDiagnosticsInGroup(Flavor, Opt, _Diags))
222 IsPositive ? diag::Severity::Remark
223 : diag::Severity::Ignored);
Includes all the separate Diagnostic headers & some related helpers.
Defines the Diagnostic-related interfaces.
const NestedNameSpecifier * Specifier
static void EmitUnknownDiagWarning(DiagnosticsEngine &Diags, diag::Flavor Flavor, StringRef Prefix, StringRef Opt)
static StringRef getNearestOption(diag::Flavor Flavor, StringRef Group)
Get the diagnostic option with the closest edit distance to the given group name.
Options for controlling the compiler diagnostics engine.
std::vector< std::string > Remarks
The list of -R... options used to alter the diagnostic mappings, with the prefixes removed.
std::vector< std::string > Warnings
The list of -W... options used to alter the diagnostic mappings, with the prefixes removed.
Concrete class used by the front-end to report problems and issues.
void setErrorsAsFatal(bool Val)
When set to true, any error reported is made a fatal error.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
void setPrintTemplateTree(bool Val)
Set tree printing, to outputting the template difference in a tree format.
void setSuppressSystemWarnings(bool Val)
When set to true mask warnings that come from system headers.
void setSeverityForAll(diag::Flavor Flavor, diag::Severity Map, SourceLocation Loc=SourceLocation())
Add the specified mapping to all diagnostics of the specified flavor.
void setIgnoreAllWarnings(bool Val)
When set to true, any unmapped warnings are ignored.
void setExtensionHandlingBehavior(diag::Severity H)
Controls whether otherwise-unmapped extension diagnostics are mapped onto ignore/warning/error.
void setTemplateBacktraceLimit(unsigned Limit)
Specify the maximum number of template instantiation notes to emit along with a given diagnostic.
void setErrorLimit(unsigned Limit)
Specify a limit for the number of errors we should emit before giving up.
void setWarningsAsErrors(bool Val)
When set to true, any warnings reported are issued as errors.
void setShowOverloads(OverloadsShown Val)
Specify which overload candidates to show when overload resolution fails.
void setEnableAllWarnings(bool Val)
When set to true, any unmapped ignored warnings are no longer ignored.
void setConstexprBacktraceLimit(unsigned Limit)
Specify the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
bool setDiagnosticGroupErrorAsFatal(StringRef Group, bool Enabled)
Set the error-as-fatal flag for the given diagnostic group.
void setShowColors(bool Val)
Set color printing, so the type diffing will inject color markers into the output.
bool setDiagnosticGroupWarningAsError(StringRef Group, bool Enabled)
Set the warning-as-error flag for the given diagnostic group.
bool setSeverityForGroup(diag::Flavor Flavor, StringRef Group, diag::Severity Map, SourceLocation Loc=SourceLocation())
Change an entire diagnostic group (e.g.
void setElideType(bool Val)
Set type eliding, to skip outputting same types occurring in template types.
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing),...
Flavor
Flavors of diagnostics we can emit.
The JSON file list parser is used to communicate input to InstallAPI.
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...