29#include "llvm/ADT/StringRef.h" 
   30#include "llvm/Support/VirtualFileSystem.h" 
   40  Diags.
Report(diag::warn_unknown_diag_option)
 
   42      << (Prefix.str() += std::string(Opt)) << !Suggestion.empty()
 
   43      << (Prefix.str() += std::string(Suggestion));
 
 
   48                                  llvm::vfs::FileSystem &VFS,
 
   61  if (Opts.TemplateBacktraceLimit)
 
   63  if (Opts.ConstexprBacktraceLimit)
 
   69  if (Opts.PedanticErrors)
 
   71  else if (Opts.Pedantic)
 
   84    bool SetDiagnostic = (
Report == 0);
 
   88    if (!SetDiagnostic && !ReportDiags)
 
   91    for (
unsigned i = 0, e = Opts.
Warnings.size(); i != e; ++i) {
 
   94      StringRef OrigOpt = Opts.
Warnings[i];
 
   97      if (Opt == 
"format=0")
 
  102      bool isPositive = !Opt.consume_front(
"no-");
 
  111      if (Opt == 
"system-headers") {
 
  119      if (Opt == 
"everything") {
 
  135      if (Opt.starts_with(
"error")) {
 
  137        if (Opt.size() > 5) {  
 
  139              Opt.substr(5) != 
"-implicit-function-declaration") {
 
  141              Diags.
Report(diag::warn_unknown_warning_specifier)
 
  142                << 
"-Werror" << (
"-W" + OrigOpt.str());
 
  145          Specifier = Opt.substr(6);
 
  148        if (Specifier.empty()) {
 
  157        } 
else if (DiagIDs->getDiagnosticsInGroup(Flavor, Specifier, _Diags)) {
 
  164      if (Opt.starts_with(
"fatal-errors")) {
 
  166        if (Opt.size() != 12) {
 
  167          if ((Opt[12] != 
'=' && Opt[12] != 
'-') || Opt.size() == 13) {
 
  169              Diags.
Report(diag::warn_unknown_warning_specifier)
 
  170                << 
"-Wfatal-errors" << (
"-W" + OrigOpt.str());
 
  173          Specifier = Opt.substr(13);
 
  176        if (Specifier.empty()) {
 
  185        } 
else if (DiagIDs->getDiagnosticsInGroup(Flavor, Specifier, _Diags)) {
 
  192        if (DiagIDs->getDiagnosticsInGroup(Flavor, Opt, _Diags))
 
  200    for (StringRef Opt : Opts.
Remarks) {
 
  205      bool IsPositive = !Opt.consume_front(
"no-");
 
  213      if (Opt == 
"everything") {
 
  220        if (DiagIDs->getDiagnosticsInGroup(Flavor, Opt, _Diags))
 
  235    if (
auto FileContents =
 
  238    } 
else if (ReportDiags) {
 
  239      Diags.
Report(diag::err_drv_no_such_file)
 
 
Includes all the separate Diagnostic headers & some related helpers.
 
Defines the Diagnostic-related interfaces.
 
Defines the Diagnostic IDs-related interfaces.
 
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::string DiagnosticSuppressionMappingsFile
Path for the file that defines diagnostic suppression mappings.
 
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 setDiagSuppressionMapping(llvm::MemoryBuffer &Input)
Diagnostic suppression mappings can be used to suppress specific diagnostics in specific files.
 
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
 
Flavor
Flavors of diagnostics we can emit.
 
@ WarningOrError
A diagnostic that indicates a problem or potential problem.
 
@ Remark
A diagnostic that indicates normal progress through compilation.
 
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing),...
 
@ Warning
Present this diagnostic as a warning.
 
@ Error
Present this diagnostic as an error.
 
@ Remark
Present this diagnostic as a remark.
 
@ Ignored
Do not present this diagnostic, ignore it.
 
The JSON file list parser is used to communicate input to InstallAPI.
 
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, llvm::vfs::FileSystem &VFS, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...