clang API Documentation

DiagnosticOptions.h
Go to the documentation of this file.
00001 //===--- DiagnosticOptions.h ------------------------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H
00011 #define LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H
00012 
00013 #include "clang/Basic/Diagnostic.h"
00014 
00015 #include <string>
00016 #include <vector>
00017 
00018 namespace clang {
00019 
00020 /// DiagnosticOptions - Options for controlling the compiler diagnostics
00021 /// engine.
00022 class DiagnosticOptions {
00023 public:
00024   unsigned IgnoreWarnings : 1;   /// -w
00025   unsigned NoRewriteMacros : 1;  /// -Wno-rewrite-macros
00026   unsigned Pedantic : 1;         /// -pedantic
00027   unsigned PedanticErrors : 1;   /// -pedantic-errors
00028   unsigned ShowColumn : 1;       /// Show column number on diagnostics.
00029   unsigned ShowLocation : 1;     /// Show source location information.
00030   unsigned ShowCarets : 1;       /// Show carets in diagnostics.
00031   unsigned ShowFixits : 1;       /// Show fixit information.
00032   unsigned ShowSourceRanges : 1; /// Show source ranges in numeric form.
00033   unsigned ShowParseableFixits : 1; /// Show machine parseable fix-its.
00034   unsigned ShowOptionNames : 1;  /// Show the option name for mappable
00035                                  /// diagnostics.
00036   unsigned ShowNoteIncludeStack : 1; /// Show include stacks for notes.
00037   unsigned ShowCategories : 2;   /// Show categories: 0 -> none, 1 -> Number,
00038                                  /// 2 -> Full Name.
00039                                  
00040   unsigned Format : 2;           /// Format for diagnostics: 
00041   enum TextDiagnosticFormat { Clang, Msvc, Vi };
00042   
00043   unsigned ShowColors : 1;       /// Show diagnostics with ANSI color sequences.
00044   unsigned ShowOverloads : 1;    /// Overload candidates to show.  Values from
00045                                  /// DiagnosticsEngine::OverloadsShown
00046   unsigned VerifyDiagnostics: 1; /// Check that diagnostics match the expected
00047                                  /// diagnostics, indicated by markers in the
00048                                  /// input source file.
00049 
00050   unsigned ErrorLimit;           /// Limit # errors emitted.
00051   unsigned MacroBacktraceLimit;  /// Limit depth of macro expansion backtrace.
00052   unsigned TemplateBacktraceLimit; /// Limit depth of instantiation backtrace.
00053   unsigned ConstexprBacktraceLimit; /// Limit depth of constexpr backtrace.
00054 
00055   /// The distance between tab stops.
00056   unsigned TabStop;
00057   enum { DefaultTabStop = 8, MaxTabStop = 100, 
00058          DefaultMacroBacktraceLimit = 6,
00059          DefaultTemplateBacktraceLimit = 10,
00060          DefaultConstexprBacktraceLimit = 10 };
00061 
00062   /// Column limit for formatting message diagnostics, or 0 if unused.
00063   unsigned MessageLength;
00064 
00065   /// If non-empty, a file to log extended build information to, for development
00066   /// testing and analysis.
00067   std::string DumpBuildInformation;
00068 
00069   /// The file to log diagnostic output to.
00070   std::string DiagnosticLogFile;
00071   
00072   /// The file to serialize diagnostics to (non-appending).
00073   std::string DiagnosticSerializationFile;
00074 
00075   /// The list of -W... options used to alter the diagnostic mappings, with the
00076   /// prefixes removed.
00077   std::vector<std::string> Warnings;
00078 
00079 public:
00080   DiagnosticOptions() {
00081     IgnoreWarnings = 0;
00082     TabStop = DefaultTabStop;
00083     MessageLength = 0;
00084     NoRewriteMacros = 0;
00085     Pedantic = 0;
00086     PedanticErrors = 0;
00087     ShowCarets = 1;
00088     ShowColors = 0;
00089     ShowOverloads = DiagnosticsEngine::Ovl_All;
00090     ShowColumn = 1;
00091     ShowFixits = 1;
00092     ShowLocation = 1;
00093     ShowOptionNames = 0;
00094     ShowCategories = 0;
00095     Format = Clang;
00096     ShowSourceRanges = 0;
00097     ShowParseableFixits = 0;
00098     VerifyDiagnostics = 0;
00099     ErrorLimit = 0;
00100     TemplateBacktraceLimit = DefaultTemplateBacktraceLimit;
00101     MacroBacktraceLimit = DefaultMacroBacktraceLimit;
00102     ConstexprBacktraceLimit = DefaultConstexprBacktraceLimit;
00103   }
00104 };
00105 
00106 }  // end namespace clang
00107 
00108 #endif