File indexing completed on 2026-05-10 08:36:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICPRINTER_H
0015 #define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICPRINTER_H
0016
0017 #include "clang/Basic/Diagnostic.h"
0018 #include "clang/Basic/LLVM.h"
0019 #include "llvm/ADT/IntrusiveRefCntPtr.h"
0020 #include <memory>
0021
0022 namespace clang {
0023 class DiagnosticOptions;
0024 class LangOptions;
0025 class TextDiagnostic;
0026
0027 class TextDiagnosticPrinter : public DiagnosticConsumer {
0028 raw_ostream &OS;
0029 IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
0030
0031
0032 std::unique_ptr<TextDiagnostic> TextDiag;
0033
0034
0035 std::string Prefix;
0036
0037 LLVM_PREFERRED_TYPE(bool)
0038 unsigned OwnsOutputStream : 1;
0039
0040 public:
0041 TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions *diags,
0042 bool OwnsOutputStream = false);
0043 ~TextDiagnosticPrinter() override;
0044
0045
0046
0047
0048 void setPrefix(std::string Value) { Prefix = std::move(Value); }
0049
0050 void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) override;
0051 void EndSourceFile() override;
0052 void HandleDiagnostic(DiagnosticsEngine::Level Level,
0053 const Diagnostic &Info) override;
0054 };
0055
0056 }
0057
0058 #endif