//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_PRINTER_H_
-#define LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_PRINTER_H_
+#ifndef LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICPRINTER_H
+#define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICPRINTER_H
#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/SourceLocation.h"
-
-namespace llvm {
- class raw_ostream;
-}
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include <memory>
namespace clang {
class DiagnosticOptions;
class LangOptions;
-class SourceManager;
+class TextDiagnostic;
-class TextDiagnosticPrinter : public DiagnosticClient {
- llvm::raw_ostream &OS;
- const LangOptions *LangOpts;
- const DiagnosticOptions *DiagOpts;
+class TextDiagnosticPrinter : public DiagnosticConsumer {
+ raw_ostream &OS;
+ IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
- SourceLocation LastWarningLoc;
- FullSourceLoc LastLoc;
- unsigned LastCaretDiagnosticWasNote : 1;
- unsigned OwnsOutputStream : 1;
+ /// \brief Handle to the currently active text diagnostic emitter.
+ std::unique_ptr<TextDiagnostic> TextDiag;
/// A string to prefix to error messages.
std::string Prefix;
+ unsigned OwnsOutputStream : 1;
+
public:
- TextDiagnosticPrinter(llvm::raw_ostream &os, const DiagnosticOptions &diags,
+ TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions *diags,
bool OwnsOutputStream = false);
virtual ~TextDiagnosticPrinter();
/// used.
void setPrefix(std::string Value) { Prefix = Value; }
- void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) {
- LangOpts = &LO;
- }
-
- void EndSourceFile() {
- LangOpts = 0;
- }
-
- void PrintIncludeStack(SourceLocation Loc, const SourceManager &SM);
-
- void HighlightRange(const SourceRange &R,
- const SourceManager &SrcMgr,
- unsigned LineNo, FileID FID,
- std::string &CaretLine,
- const std::string &SourceLine);
-
- void EmitCaretDiagnostic(SourceLocation Loc,
- SourceRange *Ranges, unsigned NumRanges,
- SourceManager &SM,
- const CodeModificationHint *Hints,
- unsigned NumHints,
- unsigned Columns);
-
- virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
- const DiagnosticInfo &Info);
+ void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) override;
+ void EndSourceFile() override;
+ void HandleDiagnostic(DiagnosticsEngine::Level Level,
+ const Diagnostic &Info) override;
};
-} // end namspace clang
+} // end namespace clang
#endif