clang  3.7.0
DiagnosticOptions.h
Go to the documentation of this file.
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 <type_traits>
17 #include <vector>
18 
19 namespace clang {
20 
21 /// \brief Specifies which overload candidates to display when overload
22 /// resolution fails.
23 enum OverloadsShown : unsigned {
24  Ovl_All, ///< Show all overloads.
25  Ovl_Best ///< Show just the "best" overload candidates.
26 };
27 
28 /// \brief A bitmask representing the diagnostic levels used by
29 /// VerifyDiagnosticConsumer.
31  None = 0,
32  Note = 1 << 0,
33  Remark = 1 << 1,
34  Warning = 1 << 2,
35  Error = 1 << 3,
36  All = Note | Remark | Warning | Error
37 };
38 
41  return static_cast<DiagnosticLevelMask>(~static_cast<UT>(M));
42 }
43 
45  DiagnosticLevelMask RHS) {
47  return static_cast<DiagnosticLevelMask>(
48  static_cast<UT>(LHS) | static_cast<UT>(RHS));
49 }
50 
52  DiagnosticLevelMask RHS) {
54  return static_cast<DiagnosticLevelMask>(
55  static_cast<UT>(LHS) & static_cast<UT>(RHS));
56 }
57 
58 raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M);
59 
60 /// \brief Options for controlling the compiler diagnostics engine.
61 class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
62 public:
64 
65  // Default values.
66  enum { DefaultTabStop = 8, MaxTabStop = 100,
71 
72  // Define simple diagnostic options (with no accessors).
73 #define DIAGOPT(Name, Bits, Default) unsigned Name : Bits;
74 #define ENUM_DIAGOPT(Name, Type, Bits, Default)
75 #include "clang/Basic/DiagnosticOptions.def"
76 
77 protected:
78  // Define diagnostic options of enumeration type. These are private, and will
79  // have accessors (below).
80 #define DIAGOPT(Name, Bits, Default)
81 #define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
82 #include "clang/Basic/DiagnosticOptions.def"
83 
84 public:
85  /// \brief The file to log diagnostic output to.
86  std::string DiagnosticLogFile;
87 
88  /// \brief The file to serialize diagnostics to (non-appending).
90 
91  /// The list of -W... options used to alter the diagnostic mappings, with the
92  /// prefixes removed.
93  std::vector<std::string> Warnings;
94 
95  /// The list of -R... options used to alter the diagnostic mappings, with the
96  /// prefixes removed.
97  std::vector<std::string> Remarks;
98 
99 public:
100  // Define accessors/mutators for diagnostic options of enumeration type.
101 #define DIAGOPT(Name, Bits, Default)
102 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \
103  Type get##Name() const { return static_cast<Type>(Name); } \
104  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
105 #include "clang/Basic/DiagnosticOptions.def"
106 
108 #define DIAGOPT(Name, Bits, Default) Name = Default;
109 #define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default);
110 #include "clang/Basic/DiagnosticOptions.def"
111  }
112 };
113 
115 
116 } // end namespace clang
117 
118 #endif
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:154
Show all overloads.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
std::vector< std::string > Warnings
DiagnosticLevelMask operator|(DiagnosticLevelMask LHS, DiagnosticLevelMask RHS)
Show just the "best" overload candidates.
Options for controlling the compiler diagnostics engine.
std::string DiagnosticSerializationFile
The file to serialize diagnostics to (non-appending).
DiagnosticOptions::TextDiagnosticFormat TextDiagnosticFormat
std::vector< std::string > Remarks
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchers.h:1639
DiagnosticLevelMask operator~(DiagnosticLevelMask M)
OverloadsShown
Specifies which overload candidates to display when overload resolution fails.
DiagnosticLevelMask
A bitmask representing the diagnostic levels used by VerifyDiagnosticConsumer.
DiagnosticLevelMask operator&(DiagnosticLevelMask LHS, DiagnosticLevelMask RHS)
std::string DiagnosticLogFile
The file to log diagnostic output to.