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_FRONTEND_DIAGNOSTICOPTIONS_H 11 #define LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H 12 13 #include "clang/Basic/Diagnostic.h" 14 15 #include <string> 16 #include <vector> 17 18 namespace clang { 19 20 /// DiagnosticOptions - Options for controlling the compiler diagnostics 21 /// engine. 22 class DiagnosticOptions { 23 public: 24 unsigned IgnoreWarnings : 1; /// -w 25 unsigned NoRewriteMacros : 1; /// -Wno-rewrite-macros 26 unsigned Pedantic : 1; /// -pedantic 27 unsigned PedanticErrors : 1; /// -pedantic-errors 28 unsigned ShowColumn : 1; /// Show column number on diagnostics. 29 unsigned ShowLocation : 1; /// Show source location information. 30 unsigned ShowCarets : 1; /// Show carets in diagnostics. 31 unsigned ShowFixits : 1; /// Show fixit information. 32 unsigned ShowSourceRanges : 1; /// Show source ranges in numeric form. 33 unsigned ShowParseableFixits : 1; /// Show machine parseable fix-its. 34 unsigned ShowOptionNames : 1; /// Show the option name for mappable 35 /// diagnostics. 36 unsigned ShowNoteIncludeStack : 1; /// Show include stacks for notes. 37 unsigned ShowCategories : 2; /// Show categories: 0 -> none, 1 -> Number, 38 /// 2 -> Full Name. 39 40 unsigned Format : 2; /// Format for diagnostics: 41 enum TextDiagnosticFormat { Clang, Msvc, Vi }; 42 43 unsigned ShowColors : 1; /// Show diagnostics with ANSI color sequences. 44 unsigned ShowOverloads : 1; /// Overload candidates to show. Values from 45 /// DiagnosticsEngine::OverloadsShown 46 unsigned VerifyDiagnostics: 1; /// Check that diagnostics match the expected 47 /// diagnostics, indicated by markers in the 48 /// input source file. 49 50 unsigned ElideType: 1; /// Elide identical types in template diffing 51 unsigned ShowTemplateTree: 1; /// Print a template tree when diffing 52 53 unsigned ErrorLimit; /// Limit # errors emitted. 54 unsigned MacroBacktraceLimit; /// Limit depth of macro expansion backtrace. 55 unsigned TemplateBacktraceLimit; /// Limit depth of instantiation backtrace. 56 unsigned ConstexprBacktraceLimit; /// Limit depth of constexpr backtrace. 57 58 /// The distance between tab stops. 59 unsigned TabStop; 60 enum { DefaultTabStop = 8, MaxTabStop = 100, 61 DefaultMacroBacktraceLimit = 6, 62 DefaultTemplateBacktraceLimit = 10, 63 DefaultConstexprBacktraceLimit = 10 }; 64 65 /// Column limit for formatting message diagnostics, or 0 if unused. 66 unsigned MessageLength; 67 68 /// If non-empty, a file to log extended build information to, for development 69 /// testing and analysis. 70 std::string DumpBuildInformation; 71 72 /// The file to log diagnostic output to. 73 std::string DiagnosticLogFile; 74 75 /// The file to serialize diagnostics to (non-appending). 76 std::string DiagnosticSerializationFile; 77 78 /// The list of -W... options used to alter the diagnostic mappings, with the 79 /// prefixes removed. 80 std::vector<std::string> Warnings; 81 82 public: DiagnosticOptions()83 DiagnosticOptions() { 84 IgnoreWarnings = 0; 85 TabStop = DefaultTabStop; 86 MessageLength = 0; 87 NoRewriteMacros = 0; 88 Pedantic = 0; 89 PedanticErrors = 0; 90 ShowCarets = 1; 91 ShowColors = 0; 92 ShowOverloads = DiagnosticsEngine::Ovl_All; 93 ShowColumn = 1; 94 ShowFixits = 1; 95 ShowLocation = 1; 96 ShowOptionNames = 0; 97 ShowCategories = 0; 98 Format = Clang; 99 ShowSourceRanges = 0; 100 ShowParseableFixits = 0; 101 VerifyDiagnostics = 0; 102 ErrorLimit = 0; 103 TemplateBacktraceLimit = DefaultTemplateBacktraceLimit; 104 MacroBacktraceLimit = DefaultMacroBacktraceLimit; 105 ConstexprBacktraceLimit = DefaultConstexprBacktraceLimit; 106 } 107 }; 108 109 } // end namespace clang 110 111 #endif 112