Warning: That file was not part of the compilation database. It may have many parsing errors.

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
19namespace clang {
20
21/// Specifies which overload candidates to display when overload
22/// resolution fails.
23enum 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.
33enum 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
42inline DiagnosticLevelMask operator~(DiagnosticLevelMask M) {
43 using UT = std::underlying_type<DiagnosticLevelMask>::type;
44 return static_cast<DiagnosticLevelMask>(~static_cast<UT>(M));
45}
46
47inline DiagnosticLevelMask operator|(DiagnosticLevelMask LHS,
48 DiagnosticLevelMask RHS) {
49 using UT = std::underlying_type<DiagnosticLevelMask>::type;
50 return static_cast<DiagnosticLevelMask>(
51 static_cast<UT>(LHS) | static_cast<UT>(RHS));
52}
53
54inline DiagnosticLevelMask operator&(DiagnosticLevelMask LHS,
55 DiagnosticLevelMask RHS) {
56 using UT = std::underlying_type<DiagnosticLevelMask>::type;
57 return static_cast<DiagnosticLevelMask>(
58 static_cast<UT>(LHS) & static_cast<UT>(RHS));
59}
60
61raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M);
62
63/// Options for controlling the compiler diagnostics engine.
64class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
65public:
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
84protected:
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
91public:
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
110public:
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 Type get##Name() const { return static_cast<Type>(Name); } \
115 void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
116#include "clang/Basic/DiagnosticOptions.def"
117
118 DiagnosticOptions() {
119#define DIAGOPT(Name, Bits, Default) Name = Default;
120#define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default);
121#include "clang/Basic/DiagnosticOptions.def"
122 }
123};
124
125using TextDiagnosticFormat = DiagnosticOptions::TextDiagnosticFormat;
126
127} // namespace clang
128
129#endif // LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
130

Warning: That file was not part of the compilation database. It may have many parsing errors.