diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/Diagnostic.h | 6 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticOptions.h (renamed from include/clang/Frontend/DiagnosticOptions.h) | 7 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 5 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 14 | ||||
-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 |
9 files changed, 29 insertions, 22 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index ef9c3cb4e5..e32da9438e 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -29,6 +29,7 @@ namespace clang { class DiagnosticConsumer; class DiagnosticBuilder; + class DiagnosticOptions; class IdentifierInfo; class DeclContext; class LangOptions; @@ -190,6 +191,7 @@ private: // backtrace stack, 0 -> no limit. ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors? IntrusiveRefCntPtr<DiagnosticIDs> Diags; + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; DiagnosticConsumer *Client; bool OwnsDiagClient; SourceManager *SourceMgr; @@ -341,6 +343,7 @@ private: public: explicit DiagnosticsEngine( const IntrusiveRefCntPtr<DiagnosticIDs> &Diags, + DiagnosticOptions *DiagOpts, DiagnosticConsumer *client = 0, bool ShouldOwnClient = true); ~DiagnosticsEngine(); @@ -349,6 +352,9 @@ public: return Diags; } + /// \brief Retrieve the diagnostic options. + DiagnosticOptions &getDiagnosticOptions() const { return *DiagOpts; } + DiagnosticConsumer *getClient() { return Client; } const DiagnosticConsumer *getClient() const { return Client; } diff --git a/include/clang/Frontend/DiagnosticOptions.h b/include/clang/Basic/DiagnosticOptions.h index 8dec37ca03..77a8476c49 100644 --- a/include/clang/Frontend/DiagnosticOptions.h +++ b/include/clang/Basic/DiagnosticOptions.h @@ -7,10 +7,11 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H -#define LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H +#ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H +#define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H #include "clang/Basic/Diagnostic.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include <string> #include <vector> @@ -19,7 +20,7 @@ namespace clang { /// DiagnosticOptions - Options for controlling the compiler diagnostics /// engine. -class DiagnosticOptions { +class DiagnosticOptions : public llvm::RefCountedBase<DiagnosticOptions>{ public: unsigned IgnoreWarnings : 1; /// -w unsigned NoRewriteMacros : 1; /// -Wno-rewrite-macros 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/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(); |