diff options
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 5 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 14 | ||||
-rw-r--r-- | include/clang/Frontend/DiagnosticOptions.h | 111 | ||||
-rw-r--r-- | include/clang/Frontend/DiagnosticRenderer.h | 6 | ||||
-rw-r--r-- | include/clang/Frontend/LogDiagnosticPrinter.h | 4 | ||||
-rw-r--r-- | include/clang/Frontend/SerializedDiagnosticPrinter.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/TextDiagnostic.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/TextDiagnosticPrinter.h | 5 |
8 files changed, 19 insertions, 130 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 149735d183..6736d1aadc 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -495,8 +495,7 @@ public: /// releasing the returned DiagnosticsEngine's client eventually. /// /// \param Opts - The diagnostic options; note that the created text - /// diagnostic object contains a reference to these options and its lifetime - /// must extend past that of the diagnostic engine. + /// diagnostic object contains a reference to these options. /// /// \param Client If non-NULL, a diagnostic client that will be /// attached to (and, then, owned by) the returned DiagnosticsEngine @@ -507,7 +506,7 @@ public: /// /// \return The new object on success, or null on failure. static IntrusiveRefCntPtr<DiagnosticsEngine> - createDiagnostics(const DiagnosticOptions &Opts, int Argc, + createDiagnostics(DiagnosticOptions *Opts, int Argc, const char* const *Argv, DiagnosticConsumer *Client = 0, bool ShouldOwnClient = true, diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index a58fef1f4b..de8f60049a 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -13,11 +13,11 @@ #include "clang/Basic/LangOptions.h" #include "clang/Basic/TargetOptions.h" #include "clang/Basic/FileSystemOptions.h" +#include "clang/Basic/DiagnosticOptions.h" #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h" #include "clang/Frontend/MigratorOptions.h" #include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/DependencyOutputOptions.h" -#include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/FrontendOptions.h" #include "clang/Frontend/HeaderSearchOptions.h" #include "clang/Frontend/LangStandard.h" @@ -55,6 +55,10 @@ protected: /// Options controlling the target. IntrusiveRefCntPtr<TargetOptions> TargetOpts; + + /// Options controlling the diagnostic engine. + IntrusiveRefCntPtr<DiagnosticOptions> DiagnosticOpts; + public: CompilerInvocationBase(); @@ -67,6 +71,8 @@ public: const TargetOptions &getTargetOpts() const { return *TargetOpts.getPtr(); } + + DiagnosticOptions &getDiagnosticOpts() const { return *DiagnosticOpts; } }; /// \brief Helper class for holding the data necessary to invoke the compiler. @@ -86,9 +92,6 @@ class CompilerInvocation : public CompilerInvocationBase { /// Options controlling dependency output. DependencyOutputOptions DependencyOutputOpts; - /// Options controlling the diagnostic engine. - DiagnosticOptions DiagnosticOpts; - /// Options controlling file system operations. FileSystemOptions FileSystemOpts; @@ -174,9 +177,6 @@ public: return DependencyOutputOpts; } - DiagnosticOptions &getDiagnosticOpts() { return DiagnosticOpts; } - const DiagnosticOptions &getDiagnosticOpts() const { return DiagnosticOpts; } - FileSystemOptions &getFileSystemOpts() { return FileSystemOpts; } const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; diff --git a/include/clang/Frontend/DiagnosticOptions.h b/include/clang/Frontend/DiagnosticOptions.h deleted file mode 100644 index 8dec37ca03..0000000000 --- a/include/clang/Frontend/DiagnosticOptions.h +++ /dev/null @@ -1,111 +0,0 @@ -//===--- 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 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 Format : 2; /// Format for diagnostics: - enum TextDiagnosticFormat { Clang, Msvc, Vi }; - - unsigned ShowColors : 1; /// Show diagnostics with ANSI color sequences. - unsigned ShowOverloads : 1; /// Overload candidates to show. Values from - /// DiagnosticsEngine::OverloadsShown - unsigned VerifyDiagnostics: 1; /// Check that diagnostics match the expected - /// diagnostics, indicated by markers in the - /// input source file. - - unsigned ElideType: 1; /// Elide identical types in template diffing - unsigned ShowTemplateTree: 1; /// Print a template tree when diffing - - unsigned ErrorLimit; /// Limit # errors emitted. - unsigned MacroBacktraceLimit; /// Limit depth of macro expansion backtrace. - unsigned TemplateBacktraceLimit; /// Limit depth of instantiation backtrace. - unsigned ConstexprBacktraceLimit; /// Limit depth of constexpr backtrace. - - /// The distance between tab stops. - unsigned TabStop; - enum { DefaultTabStop = 8, MaxTabStop = 100, - DefaultMacroBacktraceLimit = 6, - DefaultTemplateBacktraceLimit = 10, - DefaultConstexprBacktraceLimit = 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 file to serialize diagnostics to (non-appending). - std::string DiagnosticSerializationFile; - - /// 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 = DiagnosticsEngine::Ovl_All; - ShowColumn = 1; - ShowFixits = 1; - ShowLocation = 1; - ShowOptionNames = 0; - ShowCategories = 0; - Format = Clang; - ShowSourceRanges = 0; - ShowParseableFixits = 0; - VerifyDiagnostics = 0; - ErrorLimit = 0; - TemplateBacktraceLimit = DefaultTemplateBacktraceLimit; - MacroBacktraceLimit = DefaultMacroBacktraceLimit; - ConstexprBacktraceLimit = DefaultConstexprBacktraceLimit; - } -}; - -} // end namespace clang - -#endif diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h index 984c003a45..086bb137d4 100644 --- a/include/clang/Frontend/DiagnosticRenderer.h +++ b/include/clang/Frontend/DiagnosticRenderer.h @@ -44,7 +44,7 @@ typedef llvm::PointerUnion<const Diagnostic *, class DiagnosticRenderer { protected: const LangOptions &LangOpts; - const DiagnosticOptions &DiagOpts; + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; /// \brief The location of the previous diagnostic if known. /// @@ -66,7 +66,7 @@ protected: DiagnosticsEngine::Level LastLevel; DiagnosticRenderer(const LangOptions &LangOpts, - const DiagnosticOptions &DiagOpts); + DiagnosticOptions *DiagOpts); virtual ~DiagnosticRenderer(); @@ -139,7 +139,7 @@ public: class DiagnosticNoteRenderer : public DiagnosticRenderer { public: DiagnosticNoteRenderer(const LangOptions &LangOpts, - const DiagnosticOptions &DiagOpts) + DiagnosticOptions *DiagOpts) : DiagnosticRenderer(LangOpts, DiagOpts) {} virtual ~DiagnosticNoteRenderer(); diff --git a/include/clang/Frontend/LogDiagnosticPrinter.h b/include/clang/Frontend/LogDiagnosticPrinter.h index 4de15f2aed..f4fa876ae3 100644 --- a/include/clang/Frontend/LogDiagnosticPrinter.h +++ b/include/clang/Frontend/LogDiagnosticPrinter.h @@ -42,7 +42,7 @@ class LogDiagnosticPrinter : public DiagnosticConsumer { raw_ostream &OS; const LangOptions *LangOpts; - const DiagnosticOptions *DiagOpts; + llvm::IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; SourceLocation LastWarningLoc; FullSourceLoc LastLoc; @@ -54,7 +54,7 @@ class LogDiagnosticPrinter : public DiagnosticConsumer { std::string DwarfDebugFlags; public: - LogDiagnosticPrinter(raw_ostream &OS, const DiagnosticOptions &Diags, + LogDiagnosticPrinter(raw_ostream &OS, DiagnosticOptions *Diags, bool OwnsOutputStream = false); virtual ~LogDiagnosticPrinter(); diff --git a/include/clang/Frontend/SerializedDiagnosticPrinter.h b/include/clang/Frontend/SerializedDiagnosticPrinter.h index aa0695fe24..ab70afd21f 100644 --- a/include/clang/Frontend/SerializedDiagnosticPrinter.h +++ b/include/clang/Frontend/SerializedDiagnosticPrinter.h @@ -54,7 +54,7 @@ enum RecordIDs { /// (via libclang) without needing to parse Clang's command line output. /// DiagnosticConsumer *create(llvm::raw_ostream *OS, - const DiagnosticOptions &diags); + DiagnosticOptions *diags); } // end serialized_diags namespace } // end clang namespace diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h index c869c08c0f..51f841ddd3 100644 --- a/include/clang/Frontend/TextDiagnostic.h +++ b/include/clang/Frontend/TextDiagnostic.h @@ -40,7 +40,7 @@ class TextDiagnostic : public DiagnosticRenderer { public: TextDiagnostic(raw_ostream &OS, const LangOptions &LangOpts, - const DiagnosticOptions &DiagOpts); + DiagnosticOptions *DiagOpts); virtual ~TextDiagnostic(); diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index 23cf5211cd..91ac3c8339 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -18,6 +18,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/LLVM.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" namespace clang { class DiagnosticOptions; @@ -26,7 +27,7 @@ class TextDiagnostic; class TextDiagnosticPrinter : public DiagnosticConsumer { raw_ostream &OS; - const DiagnosticOptions *DiagOpts; + llvm::IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; /// \brief Handle to the currently active text diagnostic emitter. OwningPtr<TextDiagnostic> TextDiag; @@ -37,7 +38,7 @@ class TextDiagnosticPrinter : public DiagnosticConsumer { unsigned OwnsOutputStream : 1; public: - TextDiagnosticPrinter(raw_ostream &os, const DiagnosticOptions &diags, + TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions *diags, bool OwnsOutputStream = false); virtual ~TextDiagnosticPrinter(); |