Coverage Report

Created: 2018-07-22 10:17

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Basic/DiagnosticOptions.h
Line
Count
Source
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
/// Specifies which overload candidates to display when overload
22
/// resolution fails.
23
enum OverloadsShown : unsigned {
24
  /// Show all overloads.
25
  Ovl_All,
26
27
  /// Show just the "best" overload candidates.
28
  Ovl_Best
29
};
30
31
/// A bitmask representing the diagnostic levels used by
32
/// VerifyDiagnosticConsumer.
33
enum class DiagnosticLevelMask : unsigned {
34
  None    = 0,
35
  Note    = 1 << 0,
36
  Remark  = 1 << 1,
37
  Warning = 1 << 2,
38
  Error   = 1 << 3,
39
  All     = Note | Remark | Warning | Error
40
};
41
42
11.2k
inline DiagnosticLevelMask operator~(DiagnosticLevelMask M) {
43
11.2k
  using UT = std::underlying_type<DiagnosticLevelMask>::type;
44
11.2k
  return static_cast<DiagnosticLevelMask>(~static_cast<UT>(M));
45
11.2k
}
46
47
inline DiagnosticLevelMask operator|(DiagnosticLevelMask LHS,
48
19
                                     DiagnosticLevelMask RHS) {
49
19
  using UT = std::underlying_type<DiagnosticLevelMask>::type;
50
19
  return static_cast<DiagnosticLevelMask>(
51
19
    static_cast<UT>(LHS) | static_cast<UT>(RHS));
52
19
}
53
54
inline DiagnosticLevelMask operator&(DiagnosticLevelMask LHS,
55
90.0k
                                     DiagnosticLevelMask RHS) {
56
90.0k
  using UT = std::underlying_type<DiagnosticLevelMask>::type;
57
90.0k
  return static_cast<DiagnosticLevelMask>(
58
90.0k
    static_cast<UT>(LHS) & static_cast<UT>(RHS));
59
90.0k
}
60
61
raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M);
62
63
/// Options for controlling the compiler diagnostics engine.
64
class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
65
public:
66
  enum TextDiagnosticFormat { Clang, MSVC, Vi };
67
68
  // Default values.
69
  enum {
70
    DefaultTabStop = 8,
71
    MaxTabStop = 100,
72
    DefaultMacroBacktraceLimit = 6,
73
    DefaultTemplateBacktraceLimit = 10,
74
    DefaultConstexprBacktraceLimit = 10,
75
    DefaultSpellCheckingLimit = 50,
76
    DefaultSnippetLineLimit = 1,
77
  };
78
79
  // Define simple diagnostic options (with no accessors).
80
#define DIAGOPT(Name, Bits, Default) unsigned Name : Bits;
81
#define ENUM_DIAGOPT(Name, Type, Bits, Default)
82
#include "clang/Basic/DiagnosticOptions.def"
83
84
protected:
85
  // Define diagnostic options of enumeration type. These are private, and will
86
  // have accessors (below).
87
#define DIAGOPT(Name, Bits, Default)
88
#define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
89
#include "clang/Basic/DiagnosticOptions.def"
90
91
public:
92
  /// The file to log diagnostic output to.
93
  std::string DiagnosticLogFile;
94
  
95
  /// The file to serialize diagnostics to (non-appending).
96
  std::string DiagnosticSerializationFile;
97
98
  /// The list of -W... options used to alter the diagnostic mappings, with the
99
  /// prefixes removed.
100
  std::vector<std::string> Warnings;
101
102
  /// The list of -R... options used to alter the diagnostic mappings, with the
103
  /// prefixes removed.
104
  std::vector<std::string> Remarks;
105
106
  /// The prefixes for comment directives sought by -verify ("expected" by
107
  /// default).
108
  std::vector<std::string> VerifyPrefixes;
109
110
public:
111
  // Define accessors/mutators for diagnostic options of enumeration type.
112
#define DIAGOPT(Name, Bits, Default)
113
#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
114
172k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::DiagnosticOptions::getShowOverloads() const
Line
Count
Source
114
73.5k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::DiagnosticOptions::getFormat() const
Line
Count
Source
114
72.6k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::DiagnosticOptions::getVerifyIgnoreUnexpected() const
Line
Count
Source
114
25.9k
  Type get##Name() const { return static_cast<Type>(Name); } \
115
676k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::DiagnosticOptions::setFormat(clang::DiagnosticOptions::TextDiagnosticFormat)
Line
Count
Source
115
225k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::DiagnosticOptions::setShowOverloads(clang::OverloadsShown)
Line
Count
Source
115
225k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::DiagnosticOptions::setVerifyIgnoreUnexpected(clang::DiagnosticLevelMask)
Line
Count
Source
115
225k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
116
#include "clang/Basic/DiagnosticOptions.def"
117
118
156k
  DiagnosticOptions() {
119
4.37M
#define DIAGOPT(Name, Bits, Default) Name = Default;
120
468k
#define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default);
121
156k
#include "clang/Basic/DiagnosticOptions.def"
122
156k
  }
123
};
124
125
using TextDiagnosticFormat = DiagnosticOptions::TextDiagnosticFormat;
126
127
} // namespace clang
128
129
#endif // LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H