summaryrefslogtreecommitdiffstats
path: root/include/clang/Frontend/DiagnosticOptions.h
blob: ff92058f01df15d57cb94f58931d98030a7142c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//===--- DiagnosticOptions.h ------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H
#define LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H

#include "clang/Basic/Diagnostic.h"

#include <string>
#include <vector>

namespace clang {

/// DiagnosticOptions - Options for controlling the compiler diagnostics
/// engine.
class DiagnosticOptions {
public:
  unsigned IgnoreWarnings : 1;   /// -w
  unsigned NoRewriteMacros : 1;  /// -Wno-rewrite-macros
  unsigned Pedantic : 1;         /// -pedantic
  unsigned PedanticErrors : 1;   /// -pedantic-errors
  unsigned ShowColumn : 1;       /// Show column number on diagnostics.
  unsigned ShowLocation : 1;     /// Show source location information.
  unsigned ShowCarets : 1;       /// Show carets in diagnostics.
  unsigned ShowFixits : 1;       /// Show fixit information.
  unsigned ShowSourceRanges : 1; /// Show source ranges in numeric form.
  unsigned ShowParseableFixits : 1; /// Show machine parseable fix-its.
  unsigned ShowNames : 1;        /// Show the diagnostic name
  unsigned ShowOptionNames : 1;  /// Show the option name for mappable
                                 /// diagnostics.
  unsigned ShowNoteIncludeStack : 1; /// Show include stacks for notes.
  unsigned ShowCategories : 2;   /// Show categories: 0 -> none, 1 -> Number,
                                 /// 2 -> Full Name.
  unsigned ShowColors : 1;       /// Show diagnostics with ANSI color sequences.
  unsigned ShowOverloads : 1;    /// Overload candidates to show.  Values from
                                 /// Diagnostic::OverloadsShown
  unsigned VerifyDiagnostics: 1; /// Check that diagnostics match the expected
                                 /// diagnostics, indicated by markers in the
                                 /// input source file.

  unsigned ErrorLimit;           /// Limit # errors emitted.
  unsigned MacroBacktraceLimit;  /// Limit depth of macro instantiation 
                                 /// backtrace.
  unsigned TemplateBacktraceLimit; /// Limit depth of instantiation backtrace.

  /// The distance between tab stops.
  unsigned TabStop;
  enum { DefaultTabStop = 8, MaxTabStop = 100, 
         DefaultMacroBacktraceLimit = 6,
         DefaultTemplateBacktraceLimit = 10 };

  /// Column limit for formatting message diagnostics, or 0 if unused.
  unsigned MessageLength;

  /// If non-empty, a file to log extended build information to, for development
  /// testing and analysis.
  std::string DumpBuildInformation;

  /// The file to log diagnostic output to.
  std::string DiagnosticLogFile;

  /// The list of -W... options used to alter the diagnostic mappings, with the
  /// prefixes removed.
  std::vector<std::string> Warnings;

public:
  DiagnosticOptions() {
    IgnoreWarnings = 0;
    TabStop = DefaultTabStop;
    MessageLength = 0;
    NoRewriteMacros = 0;
    Pedantic = 0;
    PedanticErrors = 0;
    ShowCarets = 1;
    ShowColors = 0;
    ShowOverloads = Diagnostic::Ovl_All;
    ShowColumn = 1;
    ShowFixits = 1;
    ShowLocation = 1;
    ShowNames = 0;
    ShowOptionNames = 0;
    ShowCategories = 0;
    ShowSourceRanges = 0;
    ShowParseableFixits = 0;
    VerifyDiagnostics = 0;
    ErrorLimit = 0;
    TemplateBacktraceLimit = DefaultTemplateBacktraceLimit;
    MacroBacktraceLimit = DefaultMacroBacktraceLimit;
  }
};

}  // end namespace clang

#endif
OpenPOWER on IntegriCloud