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 ShowNames : 1; /// Show the diagnostic name 35 unsigned ShowOptionNames : 1; /// Show the option name for mappable 36 /// diagnostics. 37 unsigned ShowNoteIncludeStack : 1; /// Show include stacks for notes. 38 unsigned ShowCategories : 2; /// Show categories: 0 -> none, 1 -> Number, 39 /// 2 -> Full Name. 40 41 unsigned Format : 2; /// Format for diagnostics: 42 enum TextDiagnosticFormat { Clang, Msvc, Vi }; 43 44 unsigned ShowColors : 1; /// Show diagnostics with ANSI color sequences. 45 unsigned ShowOverloads : 1; /// Overload candidates to show. Values from 46 /// Diagnostic::OverloadsShown 47 unsigned VerifyDiagnostics: 1; /// Check that diagnostics match the expected 48 /// diagnostics, indicated by markers in the 49 /// input source file. 50 51 unsigned ErrorLimit; /// Limit # errors emitted. 52 unsigned MacroBacktraceLimit; /// Limit depth of macro expansion backtrace. 53 unsigned TemplateBacktraceLimit; /// Limit depth of instantiation backtrace. 54 55 /// The distance between tab stops. 56 unsigned TabStop; 57 enum { DefaultTabStop = 8, MaxTabStop = 100, 58 DefaultMacroBacktraceLimit = 6, 59 DefaultTemplateBacktraceLimit = 10 }; 60 61 /// Column limit for formatting message diagnostics, or 0 if unused. 62 unsigned MessageLength; 63 64 /// If non-empty, a file to log extended build information to, for development 65 /// testing and analysis. 66 std::string DumpBuildInformation; 67 68 /// The file to log diagnostic output to. 69 std::string DiagnosticLogFile; 70 71 /// The list of -W... options used to alter the diagnostic mappings, with the 72 /// prefixes removed. 73 std::vector<std::string> Warnings; 74 75 public: 76 DiagnosticOptions() { 77 IgnoreWarnings = 0; 78 TabStop = DefaultTabStop; 79 MessageLength = 0; 80 NoRewriteMacros = 0; 81 Pedantic = 0; 82 PedanticErrors = 0; 83 ShowCarets = 1; 84 ShowColors = 0; 85 ShowOverloads = Diagnostic::Ovl_All; 86 ShowColumn = 1; 87 ShowFixits = 1; 88 ShowLocation = 1; 89 ShowNames = 0; 90 ShowOptionNames = 0; 91 ShowCategories = 0; 92 Format = Clang; 93 ShowSourceRanges = 0; 94 ShowParseableFixits = 0; 95 VerifyDiagnostics = 0; 96 ErrorLimit = 0; 97 TemplateBacktraceLimit = DefaultTemplateBacktraceLimit; 98 MacroBacktraceLimit = DefaultMacroBacktraceLimit; 99 } 100 }; 101 102 } // end namespace clang 103 104 #endif 105