FLANG
|
#include <flang/Frontend/TextDiagnostic.h>
Static Public Member Functions | |
static void | printDiagnosticLevel (llvm::raw_ostream &os, clang::DiagnosticsEngine::Level level, bool showColors) |
static void | printDiagnosticMessage (llvm::raw_ostream &os, bool isSupplemental, llvm::StringRef message, bool showColors) |
Class to encapsulate the logic for formatting and printing a textual diagnostic message.
The purpose of this class is to isolate the implementation of printing beautiful text diagnostics from any particular interfaces. Currently only simple diagnostics that lack source location information are supported (e.g. Flang driver errors).
In the future we can extend this class (akin to Clang) to support more complex diagnostics that would include macro backtraces, caret diagnostics, FixIt Hints and code snippets.
|
static |
Print the diagnostic level to a llvm::raw_ostream.
This is a static helper that handles colorizing the level and formatting it into an arbitrary output stream.
os | Where the message is printed |
level | The diagnostic level (e.g. error or warning) |
showColors | Enable colorizing of the message. |
|
static |
Pretty-print a diagnostic message to a llvm::raw_ostream.
This is a static helper to handle the colorizing and rendering diagnostic message to a particular ostream. In the future we can extend it to support e.g. line wrapping. It is publicly visible as at this stage we don't require any state data to print a diagnostic.
os | Where the message is printed |
isSupplemental | true if this is a continuation note diagnostic |
message | The text actually printed |
showColors | Enable colorizing of the message. |