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 : unsigned {
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     DefaultSpellCheckingLimit = 50 };
38 
39   // Define simple diagnostic options (with no accessors).
40 #define DIAGOPT(Name, Bits, Default) unsigned Name : Bits;
41 #define ENUM_DIAGOPT(Name, Type, Bits, Default)
42 #include "clang/Basic/DiagnosticOptions.def"
43 
44 protected:
45   // Define diagnostic options of enumeration type. These are private, and will
46   // have accessors (below).
47 #define DIAGOPT(Name, Bits, Default)
48 #define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
49 #include "clang/Basic/DiagnosticOptions.def"
50 
51 public:
52   /// \brief The file to log diagnostic output to.
53   std::string DiagnosticLogFile;
54 
55   /// \brief The file to serialize diagnostics to (non-appending).
56   std::string DiagnosticSerializationFile;
57 
58   /// The list of -W... options used to alter the diagnostic mappings, with the
59   /// prefixes removed.
60   std::vector<std::string> Warnings;
61 
62   /// The list of -R... options used to alter the diagnostic mappings, with the
63   /// prefixes removed.
64   std::vector<std::string> Remarks;
65 
66 public:
67   // Define accessors/mutators for diagnostic options of enumeration type.
68 #define DIAGOPT(Name, Bits, Default)
69 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \
70   Type get##Name() const { return static_cast<Type>(Name); } \
71   void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
72 #include "clang/Basic/DiagnosticOptions.def"
73 
DiagnosticOptions()74   DiagnosticOptions() {
75 #define DIAGOPT(Name, Bits, Default) Name = Default;
76 #define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default);
77 #include "clang/Basic/DiagnosticOptions.def"
78   }
79 };
80 
81 typedef DiagnosticOptions::TextDiagnosticFormat TextDiagnosticFormat;
82 
83 }  // end namespace clang
84 
85 #endif
86