Home | History | Annotate | Download | only in Basic
      1 //===--- DiagnosticOptions.h ------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
     11 #define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
     12 
     13 #include "clang/Basic/LLVM.h"
     14 #include "llvm/ADT/IntrusiveRefCntPtr.h"
     15 #include <string>
     16 #include <vector>
     17 
     18 namespace clang {
     19 
     20 /// \brief Specifies which overload candidates to display when overload
     21 /// resolution fails.
     22 enum OverloadsShown {
     23   Ovl_All,  ///< Show all overloads.
     24   Ovl_Best  ///< Show just the "best" overload candidates.
     25 };
     26 
     27 /// \brief Options for controlling the compiler diagnostics engine.
     28 class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
     29 public:
     30   enum TextDiagnosticFormat { Clang, Msvc, Vi };
     31 
     32   // Default values.
     33   enum { DefaultTabStop = 8, MaxTabStop = 100,
     34     DefaultMacroBacktraceLimit = 6,
     35     DefaultTemplateBacktraceLimit = 10,
     36     DefaultConstexprBacktraceLimit = 10 };
     37 
     38   // Define simple diagnostic options (with no accessors).
     39 #define DIAGOPT(Name, Bits, Default) unsigned Name : Bits;
     40 #define ENUM_DIAGOPT(Name, Type, Bits, Default)
     41 #include "clang/Basic/DiagnosticOptions.def"
     42 
     43 protected:
     44   // Define diagnostic options of enumeration type. These are private, and will
     45   // have accessors (below).
     46 #define DIAGOPT(Name, Bits, Default)
     47 #define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
     48 #include "clang/Basic/DiagnosticOptions.def"
     49 
     50 public:
     51   /// \brief The file to log diagnostic output to.
     52   std::string DiagnosticLogFile;
     53 
     54   /// \brief The file to serialize diagnostics to (non-appending).
     55   std::string DiagnosticSerializationFile;
     56 
     57   /// The list of -W... options used to alter the diagnostic mappings, with the
     58   /// prefixes removed.
     59   std::vector<std::string> Warnings;
     60 
     61 public:
     62   // Define accessors/mutators for diagnostic options of enumeration type.
     63 #define DIAGOPT(Name, Bits, Default)
     64 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \
     65   Type get##Name() const { return static_cast<Type>(Name); } \
     66   void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
     67 #include "clang/Basic/DiagnosticOptions.def"
     68 
     69   DiagnosticOptions() {
     70 #define DIAGOPT(Name, Bits, Default) Name = Default;
     71 #define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default);
     72 #include "clang/Basic/DiagnosticOptions.def"
     73   }
     74 };
     75 
     76 typedef DiagnosticOptions::TextDiagnosticFormat TextDiagnosticFormat;
     77 
     78 }  // end namespace clang
     79 
     80 #endif
     81