diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 08:13:24 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 08:13:24 +0000 |
commit | dbf75feeb6e1b0015b72fa42c80b45497e9ffefc (patch) | |
tree | c0c8246aa1a129cbe7a9d664697b44fc9875225c /include/clang/Frontend | |
parent | 56749087b5818f323e9e71a514274cdc5e7bfd46 (diff) |
Turn LoggingDiagnosticClient into a more general ChainedDiagnosticClient and
move to libFrontend.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/ChainedDiagnosticClient.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/clang/Frontend/ChainedDiagnosticClient.h b/include/clang/Frontend/ChainedDiagnosticClient.h new file mode 100644 index 0000000000..9dc3898f4e --- /dev/null +++ b/include/clang/Frontend/ChainedDiagnosticClient.h @@ -0,0 +1,56 @@ +//===--- ChainedDiagnosticClient.h - Chain Diagnostic Clients ---*- 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_CHAINEDDIAGNOSTICCLIENT_H +#define LLVM_CLANG_FRONTEND_CHAINEDDIAGNOSTICCLIENT_H + +#include "clang/Basic/Diagnostic.h" + +namespace clang { +class LangOptions; + +/// ChainedDiagnosticClient - Chain two diagnostic clients so that diagnostics +/// go to the first client and then the second. The first diagnostic client +/// should be the "primary" client, and will be used for computing whether the +/// diagnostics should be included in counts. +class ChainedDiagnosticClient : public DiagnosticClient { + llvm::OwningPtr<DiagnosticClient> Primary; + llvm::OwningPtr<DiagnosticClient> Secondary; + +public: + ChainedDiagnosticClient(DiagnosticClient *_Primary, + DiagnosticClient *_Secondary) { + Primary.reset(_Primary); + Secondary.reset(_Secondary); + } + + virtual void BeginSourceFile(const LangOptions &LO) { + Primary->BeginSourceFile(LO); + Secondary->BeginSourceFile(LO); + } + + virtual void EndSourceFile() { + Secondary->EndSourceFile(); + Primary->EndSourceFile(); + } + + virtual bool IncludeInDiagnosticCounts() const { + return Primary->IncludeInDiagnosticCounts(); + } + + virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + const DiagnosticInfo &Info) { + Primary->HandleDiagnostic(DiagLevel, Info); + Secondary->HandleDiagnostic(DiagLevel, Info); + } +}; + +} // end namspace clang + +#endif |