31 using namespace clang;
39 Diags.
Report(diag::warn_unknown_diag_option)
41 << !Suggestion.empty() << (Prefix.str() += 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) {
91 StringRef OrigOpt = Opts.
Warnings[i];
94 if (Opt ==
"format=0")
99 bool isPositive =
true;
100 if (Opt.startswith(
"no-")) {
112 if (Opt ==
"system-headers") {
120 if (Opt ==
"everything") {
134 if (Opt.startswith(
"error")) {
136 if (Opt.size() > 5) {
137 if ((Opt[5] !=
'=' && Opt[5] !=
'-') || Opt.size() == 6) {
139 Diags.
Report(diag::warn_unknown_warning_specifier)
140 <<
"-Werror" << (
"-W" + OrigOpt.str());
143 Specifier = Opt.substr(6);
146 if (Specifier.empty()) {
155 }
else if (DiagIDs->getDiagnosticsInGroup(
Flavor, Specifier, _Diags)) {
162 if (Opt.startswith(
"fatal-errors")) {
164 if (Opt.size() != 12) {
165 if ((Opt[12] !=
'=' && Opt[12] !=
'-') || Opt.size() == 13) {
167 Diags.
Report(diag::warn_unknown_warning_specifier)
168 <<
"-Wfatal-errors" << (
"-W" + OrigOpt.str());
171 Specifier = Opt.substr(13);
174 if (Specifier.empty()) {
183 }
else if (DiagIDs->getDiagnosticsInGroup(
Flavor, Specifier, _Diags)) {
190 if (DiagIDs->getDiagnosticsInGroup(
Flavor, Opt, _Diags))
198 for (
unsigned i = 0, e = Opts.
Remarks.size(); i != e; ++i) {
199 StringRef Opt = Opts.
Remarks[i];
204 bool IsPositive = !Opt.startswith(
"no-");
205 if (!IsPositive) Opt = Opt.substr(3);
213 if (Opt ==
"everything") {
220 if (DiagIDs->getDiagnosticsInGroup(
Flavor, Opt, _Diags))
A diagnostic that indicates a problem or potential problem.
void setSeverityForAll(diag::Flavor Flavor, diag::Severity Map, SourceLocation Loc=SourceLocation())
Add the specified mapping to all diagnostics of the specified flavor.
void setShowColors(bool Val=false)
Set color printing, so the type diffing will inject color markers into the output.
void setShowOverloads(OverloadsShown Val)
Specify which overload candidates to show when overload resolution fails.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
const NestedNameSpecifier * Specifier
bool setDiagnosticGroupWarningAsError(StringRef Group, bool Enabled)
Set the warning-as-error flag for the given diagnostic group.
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing)...
void setTemplateBacktraceLimit(unsigned Limit)
Specify the maximum number of template instantiation notes to emit along with a given diagnostic...
Includes all the separate Diagnostic headers & some related helpers.
bool setDiagnosticGroupErrorAsFatal(StringRef Group, bool Enabled)
Set the error-as-fatal flag for the given diagnostic group.
void setExtensionHandlingBehavior(diag::Severity H)
Controls whether otherwise-unmapped extension diagnostics are mapped onto ignore/warning/error.
void setPrintTemplateTree(bool Val=false)
Set tree printing, to outputting the template difference in a tree format.
static StringRef getNearestOption(diag::Flavor Flavor, StringRef Group)
Get the diagnostic option with the closest edit distance to the given group name. ...
Concrete class used by the front-end to report problems and issues.
bool setSeverityForGroup(diag::Flavor Flavor, StringRef Group, diag::Severity Map, SourceLocation Loc=SourceLocation())
Change an entire diagnostic group (e.g.
Defines the Diagnostic-related interfaces.
Present this diagnostic as an error.
std::vector< std::string > Warnings
The list of -W...
void setElideType(bool Val=true)
Set type eliding, to skip outputting same types occurring in template types.
void setEnableAllWarnings(bool Val)
When set to true, any unmapped ignored warnings are no longer ignored.
void setSuppressSystemWarnings(bool Val)
When set to true mask warnings that come from system headers.
Options for controlling the compiler diagnostics engine.
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...
std::vector< std::string > Remarks
The list of -R...
Flavor
Flavors of diagnostics we can emit.
void setErrorLimit(unsigned Limit)
Specify a limit for the number of errors we should emit before giving up.
void setIgnoreAllWarnings(bool Val)
When set to true, any unmapped warnings are ignored.
Dataflow Directional Tag Classes.
Present this diagnostic as a remark.
void setErrorsAsFatal(bool Val)
When set to true, any error reported is made a fatal error.
void setWarningsAsErrors(bool Val)
When set to true, any warnings reported are issued as errors.
void setConstexprBacktraceLimit(unsigned Limit)
Specify the maximum number of constexpr evaluation notes to emit along with a given diagnostic...
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
Do not present this diagnostic, ignore it.
A diagnostic that indicates normal progress through compilation.
Present this diagnostic as a warning.
static void EmitUnknownDiagWarning(DiagnosticsEngine &Diags, diag::Flavor Flavor, StringRef Prefix, StringRef Opt)