File: DiagnosticOptions.h

package info (click to toggle)
llvm-toolchain-5.0 1:5.0.1-2~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 553,688 kB
  • sloc: cpp: 2,878,786; ansic: 584,110; asm: 246,252; python: 124,751; objc: 106,925; sh: 21,542; lisp: 8,628; pascal: 5,885; ml: 5,544; perl: 5,312; makefile: 2,208; cs: 2,022; xml: 686; php: 212; csh: 117
file content (122 lines) | stat: -rw-r--r-- 4,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//===--- DiagnosticOptions.h ------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
#define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H

#include "clang/Basic/LLVM.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include <string>
#include <type_traits>
#include <vector>

namespace clang {

/// \brief Specifies which overload candidates to display when overload
/// resolution fails.
enum OverloadsShown : unsigned {
  Ovl_All,  ///< Show all overloads.
  Ovl_Best  ///< Show just the "best" overload candidates.
};

/// \brief A bitmask representing the diagnostic levels used by
/// VerifyDiagnosticConsumer.
enum class DiagnosticLevelMask : unsigned {
  None    = 0,
  Note    = 1 << 0,
  Remark  = 1 << 1,
  Warning = 1 << 2,
  Error   = 1 << 3,
  All     = Note | Remark | Warning | Error
};

inline DiagnosticLevelMask operator~(DiagnosticLevelMask M) {
  using UT = std::underlying_type<DiagnosticLevelMask>::type;
  return static_cast<DiagnosticLevelMask>(~static_cast<UT>(M));
}

inline DiagnosticLevelMask operator|(DiagnosticLevelMask LHS,
                                     DiagnosticLevelMask RHS) {
  using UT = std::underlying_type<DiagnosticLevelMask>::type;
  return static_cast<DiagnosticLevelMask>(
    static_cast<UT>(LHS) | static_cast<UT>(RHS));
}

inline DiagnosticLevelMask operator&(DiagnosticLevelMask LHS,
                                     DiagnosticLevelMask RHS) {
  using UT = std::underlying_type<DiagnosticLevelMask>::type;
  return static_cast<DiagnosticLevelMask>(
    static_cast<UT>(LHS) & static_cast<UT>(RHS));
}

raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M);

/// \brief Options for controlling the compiler diagnostics engine.
class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
public:
  enum TextDiagnosticFormat { Clang, MSVC, Vi };

  // Default values.
  enum {
    DefaultTabStop = 8,
    MaxTabStop = 100,
    DefaultMacroBacktraceLimit = 6,
    DefaultTemplateBacktraceLimit = 10,
    DefaultConstexprBacktraceLimit = 10,
    DefaultSpellCheckingLimit = 50,
    DefaultSnippetLineLimit = 1,
  };

  // Define simple diagnostic options (with no accessors).
#define DIAGOPT(Name, Bits, Default) unsigned Name : Bits;
#define ENUM_DIAGOPT(Name, Type, Bits, Default)
#include "clang/Basic/DiagnosticOptions.def"

protected:
  // Define diagnostic options of enumeration type. These are private, and will
  // have accessors (below).
#define DIAGOPT(Name, Bits, Default)
#define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
#include "clang/Basic/DiagnosticOptions.def"

public:
  /// \brief The file to log diagnostic output to.
  std::string DiagnosticLogFile;
  
  /// \brief The file to serialize diagnostics to (non-appending).
  std::string DiagnosticSerializationFile;

  /// The list of -W... options used to alter the diagnostic mappings, with the
  /// prefixes removed.
  std::vector<std::string> Warnings;

  /// The list of -R... options used to alter the diagnostic mappings, with the
  /// prefixes removed.
  std::vector<std::string> Remarks;

public:
  // Define accessors/mutators for diagnostic options of enumeration type.
#define DIAGOPT(Name, Bits, Default)
#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
  Type get##Name() const { return static_cast<Type>(Name); } \
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
#include "clang/Basic/DiagnosticOptions.def"

  DiagnosticOptions() {
#define DIAGOPT(Name, Bits, Default) Name = Default;
#define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default);
#include "clang/Basic/DiagnosticOptions.def"
  }
};

typedef DiagnosticOptions::TextDiagnosticFormat TextDiagnosticFormat;

}  // end namespace clang

#endif