clang API Documentation
00001 //===--- DiagnosticOptions.h ------------------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H 00011 #define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H 00012 00013 #include "clang/Basic/LLVM.h" 00014 #include "llvm/ADT/IntrusiveRefCntPtr.h" 00015 #include <string> 00016 #include <vector> 00017 00018 namespace clang { 00019 00020 /// \brief Specifies which overload candidates to display when overload 00021 /// resolution fails. 00022 enum OverloadsShown : unsigned { 00023 Ovl_All, ///< Show all overloads. 00024 Ovl_Best ///< Show just the "best" overload candidates. 00025 }; 00026 00027 /// \brief Options for controlling the compiler diagnostics engine. 00028 class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{ 00029 public: 00030 enum TextDiagnosticFormat { Clang, Msvc, Vi }; 00031 00032 // Default values. 00033 enum { DefaultTabStop = 8, MaxTabStop = 100, 00034 DefaultMacroBacktraceLimit = 6, 00035 DefaultTemplateBacktraceLimit = 10, 00036 DefaultConstexprBacktraceLimit = 10 }; 00037 00038 // Define simple diagnostic options (with no accessors). 00039 #define DIAGOPT(Name, Bits, Default) unsigned Name : Bits; 00040 #define ENUM_DIAGOPT(Name, Type, Bits, Default) 00041 #include "clang/Basic/DiagnosticOptions.def" 00042 00043 protected: 00044 // Define diagnostic options of enumeration type. These are private, and will 00045 // have accessors (below). 00046 #define DIAGOPT(Name, Bits, Default) 00047 #define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits; 00048 #include "clang/Basic/DiagnosticOptions.def" 00049 00050 public: 00051 /// \brief The file to log diagnostic output to. 00052 std::string DiagnosticLogFile; 00053 00054 /// \brief The file to serialize diagnostics to (non-appending). 00055 std::string DiagnosticSerializationFile; 00056 00057 /// The list of -W... options used to alter the diagnostic mappings, with the 00058 /// prefixes removed. 00059 std::vector<std::string> Warnings; 00060 00061 /// The list of -R... options used to alter the diagnostic mappings, with the 00062 /// prefixes removed. 00063 std::vector<std::string> Remarks; 00064 00065 public: 00066 // Define accessors/mutators for diagnostic options of enumeration type. 00067 #define DIAGOPT(Name, Bits, Default) 00068 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \ 00069 Type get##Name() const { return static_cast<Type>(Name); } \ 00070 void set##Name(Type Value) { Name = static_cast<unsigned>(Value); } 00071 #include "clang/Basic/DiagnosticOptions.def" 00072 00073 DiagnosticOptions() { 00074 #define DIAGOPT(Name, Bits, Default) Name = Default; 00075 #define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default); 00076 #include "clang/Basic/DiagnosticOptions.def" 00077 } 00078 }; 00079 00080 typedef DiagnosticOptions::TextDiagnosticFormat TextDiagnosticFormat; 00081 00082 } // end namespace clang 00083 00084 #endif