Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TClingDiagnostics.h
Go to the documentation of this file.
1// @(#)root/core/metacling:$Id$
2// Author: Javier Lopez-Gomez 16/07/2021
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TClingDiagnostics
13#define ROOT_TClingDiagnostics
14
15#include "clang/Frontend/TextDiagnosticPrinter.h"
16#include "llvm/Support/raw_ostream.h"
17
18#include <string>
19
20namespace clang {
21 class LangOptions;
22}
23
24/// \brief Uses `clang::TextDiagnosticPrinter` to format diagnostics, which
25/// are then passed to a user-specified function.
26///
27class TClingDelegateDiagnosticPrinter : public clang::TextDiagnosticPrinter {
28public:
29 typedef void (*handler_t)(clang::DiagnosticsEngine::Level Level,
30 const std::string &Info);
31private:
32 std::string fOS_out;
33 llvm::raw_string_ostream fOS;
35
36public:
37 TClingDelegateDiagnosticPrinter(clang::DiagnosticOptions *DiagOpts,
38 clang::LangOptions &LangOpts, handler_t fn);
40
41 void HandleDiagnostic(clang::DiagnosticsEngine::Level Level,
42 const clang::Diagnostic &Info) override;
43};
44
45#endif // ROOT_TClingDiagnostics
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:218
Uses clang::TextDiagnosticPrinter to format diagnostics, which are then passed to a user-specified fu...
void HandleDiagnostic(clang::DiagnosticsEngine::Level Level, const clang::Diagnostic &Info) override
~TClingDelegateDiagnosticPrinter() override=default
llvm::raw_string_ostream fOS
void(* handler_t)(clang::DiagnosticsEngine::Level Level, const std::string &Info)