| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | #ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H |
| 10 | #define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H |
| 11 | |
| 12 | #include "clang/Basic/LLVM.h" |
| 13 | #include "llvm/ADT/IntrusiveRefCntPtr.h" |
| 14 | #include <string> |
| 15 | #include <type_traits> |
| 16 | #include <vector> |
| 17 | |
| 18 | namespace clang { |
| 19 | |
| 20 | |
| 21 | |
| 22 | enum OverloadsShown : unsigned { |
| 23 | |
| 24 | Ovl_All, |
| 25 | |
| 26 | |
| 27 | Ovl_Best |
| 28 | }; |
| 29 | |
| 30 | |
| 31 | |
| 32 | enum class DiagnosticLevelMask : unsigned { |
| 33 | None = 0, |
| 34 | Note = 1 << 0, |
| 35 | = 1 << 1, |
| 36 | Warning = 1 << 2, |
| 37 | Error = 1 << 3, |
| 38 | All = Note | Remark | Warning | Error |
| 39 | }; |
| 40 | |
| 41 | inline DiagnosticLevelMask operator~(DiagnosticLevelMask M) { |
| 42 | using UT = std::underlying_type<DiagnosticLevelMask>::type; |
| 43 | return static_cast<DiagnosticLevelMask>(~static_cast<UT>(M)); |
| 44 | } |
| 45 | |
| 46 | inline DiagnosticLevelMask operator|(DiagnosticLevelMask LHS, |
| 47 | DiagnosticLevelMask RHS) { |
| 48 | using UT = std::underlying_type<DiagnosticLevelMask>::type; |
| 49 | return static_cast<DiagnosticLevelMask>( |
| 50 | static_cast<UT>(LHS) | static_cast<UT>(RHS)); |
| 51 | } |
| 52 | |
| 53 | inline DiagnosticLevelMask operator&(DiagnosticLevelMask LHS, |
| 54 | DiagnosticLevelMask RHS) { |
| 55 | using UT = std::underlying_type<DiagnosticLevelMask>::type; |
| 56 | return static_cast<DiagnosticLevelMask>( |
| 57 | static_cast<UT>(LHS) & static_cast<UT>(RHS)); |
| 58 | } |
| 59 | |
| 60 | raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M); |
| 61 | |
| 62 | |
| 63 | class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{ |
| 64 | public: |
| 65 | enum TextDiagnosticFormat { Clang, MSVC, Vi }; |
| 66 | |
| 67 | |
| 68 | enum { |
| 69 | DefaultTabStop = 8, |
| 70 | MaxTabStop = 100, |
| 71 | DefaultMacroBacktraceLimit = 6, |
| 72 | DefaultTemplateBacktraceLimit = 10, |
| 73 | DefaultConstexprBacktraceLimit = 10, |
| 74 | DefaultSpellCheckingLimit = 50, |
| 75 | DefaultSnippetLineLimit = 1, |
| 76 | }; |
| 77 | |
| 78 | |
| 79 | #define DIAGOPT(Name, Bits, Default) unsigned Name : Bits; |
| 80 | #define ENUM_DIAGOPT(Name, Type, Bits, Default) |
| 81 | #include "clang/Basic/DiagnosticOptions.def" |
| 82 | |
| 83 | protected: |
| 84 | |
| 85 | |
| 86 | #define DIAGOPT(Name, Bits, Default) |
| 87 | #define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits; |
| 88 | #include "clang/Basic/DiagnosticOptions.def" |
| 89 | |
| 90 | public: |
| 91 | |
| 92 | std::string DiagnosticLogFile; |
| 93 | |
| 94 | |
| 95 | std::string DiagnosticSerializationFile; |
| 96 | |
| 97 | |
| 98 | |
| 99 | std::vector<std::string> Warnings; |
| 100 | |
| 101 | |
| 102 | |
| 103 | std::vector<std::string> ; |
| 104 | |
| 105 | |
| 106 | |
| 107 | std::vector<std::string> VerifyPrefixes; |
| 108 | |
| 109 | public: |
| 110 | |
| 111 | #define DIAGOPT(Name, Bits, Default) |
| 112 | #define ENUM_DIAGOPT(Name, Type, Bits, Default) \ |
| 113 | Type get##Name() const { return static_cast<Type>(Name); } \ |
| 114 | void set##Name(Type Value) { Name = static_cast<unsigned>(Value); } |
| 115 | #include "clang/Basic/DiagnosticOptions.def" |
| 116 | |
| 117 | DiagnosticOptions() { |
| 118 | #define DIAGOPT(Name, Bits, Default) Name = Default; |
| 119 | #define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default); |
| 120 | #include "clang/Basic/DiagnosticOptions.def" |
| 121 | } |
| 122 | }; |
| 123 | |
| 124 | using TextDiagnosticFormat = DiagnosticOptions::TextDiagnosticFormat; |
| 125 | |
| 126 | } |
| 127 | |
| 128 | #endif |
| 129 | |