1eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar//===--- DiagnosticOptions.h ------------------------------------*- C++ -*-===//
2eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar//
3eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar//                     The LLVM Compiler Infrastructure
4eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar//
5eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar// This file is distributed under the University of Illinois Open Source
6eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar// License. See LICENSE.TXT for details.
7eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar//
8eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar//===----------------------------------------------------------------------===//
9eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar
1002c23ebf41ae2f70da0ba7337e05c51fbfe35f7fDouglas Gregor#ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
1102c23ebf41ae2f70da0ba7337e05c51fbfe35f7fDouglas Gregor#define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
12eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar
13cfa88f893915ceb8ae4ce2f17c46c24a4d67502fDmitri Gribenko#include "clang/Basic/LLVM.h"
1402c23ebf41ae2f70da0ba7337e05c51fbfe35f7fDouglas Gregor#include "llvm/ADT/IntrusiveRefCntPtr.h"
15eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar#include <string>
16eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar#include <vector>
17eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar
18eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbarnamespace clang {
19eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar
20dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor/// \brief Specifies which overload candidates to display when overload
21dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor/// resolution fails.
226bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hinesenum OverloadsShown : unsigned {
23dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  Ovl_All,  ///< Show all overloads.
24dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  Ovl_Best  ///< Show just the "best" overload candidates.
25dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor};
26dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor
276c31f7c56f54cc1c52475675335729290663535cJames Dennett/// \brief Options for controlling the compiler diagnostics engine.
28cfa88f893915ceb8ae4ce2f17c46c24a4d67502fDmitri Gribenkoclass DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
29eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbarpublic:
30c9471b0ff1815ed0149dbfcad0f385ed8648eeb0Douglas Gregor  enum TextDiagnosticFormat { Clang, Msvc, Vi };
31eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar
325f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregor  // Default values.
335f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregor  enum { DefaultTabStop = 8, MaxTabStop = 100,
345f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregor    DefaultMacroBacktraceLimit = 6,
355f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregor    DefaultTemplateBacktraceLimit = 10,
365f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregor    DefaultConstexprBacktraceLimit = 10 };
375f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregor
38dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  // Define simple diagnostic options (with no accessors).
39dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define DIAGOPT(Name, Bits, Default) unsigned Name : Bits;
40dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define ENUM_DIAGOPT(Name, Type, Bits, Default)
41dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#include "clang/Basic/DiagnosticOptions.def"
42246b6aa6763de8c617d564ef33123a8f3293a80eRichard Trieu
43dc7b641574a733624489bd87fc7061771edf2113Douglas Gregorprotected:
44dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  // Define diagnostic options of enumeration type. These are private, and will
45dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  // have accessors (below).
46dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define DIAGOPT(Name, Bits, Default)
47dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
48dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#include "clang/Basic/DiagnosticOptions.def"
49dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor
50dc7b641574a733624489bd87fc7061771edf2113Douglas Gregorpublic:
516c31f7c56f54cc1c52475675335729290663535cJames Dennett  /// \brief The file to log diagnostic output to.
5208c6695f6018fb6cb1a7c7d311a851aa5c233bc0Daniel Dunbar  std::string DiagnosticLogFile;
537800212ef29be314d55814e8dcc568ff8beed106Ted Kremenek
546c31f7c56f54cc1c52475675335729290663535cJames Dennett  /// \brief The file to serialize diagnostics to (non-appending).
557800212ef29be314d55814e8dcc568ff8beed106Ted Kremenek  std::string DiagnosticSerializationFile;
5608c6695f6018fb6cb1a7c7d311a851aa5c233bc0Daniel Dunbar
576907943901e0aae5be7618c36c0f8275634e6ab5Daniel Dunbar  /// The list of -W... options used to alter the diagnostic mappings, with the
586907943901e0aae5be7618c36c0f8275634e6ab5Daniel Dunbar  /// prefixes removed.
596907943901e0aae5be7618c36c0f8275634e6ab5Daniel Dunbar  std::vector<std::string> Warnings;
606907943901e0aae5be7618c36c0f8275634e6ab5Daniel Dunbar
61eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbarpublic:
62dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  // Define accessors/mutators for diagnostic options of enumeration type.
63dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define DIAGOPT(Name, Bits, Default)
64dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
65dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  Type get##Name() const { return static_cast<Type>(Name); } \
66dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
67dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#include "clang/Basic/DiagnosticOptions.def"
68dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor
69eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar  DiagnosticOptions() {
70dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define DIAGOPT(Name, Bits, Default) Name = Default;
71dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default);
72dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#include "clang/Basic/DiagnosticOptions.def"
73eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar  }
74eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar};
75eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar
765f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregortypedef DiagnosticOptions::TextDiagnosticFormat TextDiagnosticFormat;
775f3d8224af99ad0d9107601c0c31b74693371cc1Douglas Gregor
78eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar}  // end namespace clang
79eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar
80eace8743030d2979251a0c5ae247371cfd9056e5Daniel Dunbar#endif
81