LLVM  9.0.0svn
RemarkStreamer.h
Go to the documentation of this file.
1 //===- llvm/IR/RemarkStreamer.h - Remark Streamer ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the main interface for outputting remarks.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_IR_REMARKSTREAMER_H
14 #define LLVM_IR_REMARKSTREAMER_H
15 
16 #include "llvm/IR/DiagnosticInfo.h"
17 #include "llvm/Support/Error.h"
20 #include "llvm/Support/Regex.h"
21 #include <string>
22 #include <vector>
23 
24 namespace llvm {
25 /// Streamer for remarks.
27  /// The filename that the remark diagnostics are emitted to.
28  const std::string Filename;
29  /// The open raw_ostream that the remark diagnostics are emitted to.
30  raw_ostream &OS;
31  /// The regex used to filter remarks based on the passes that emit them.
32  Optional<Regex> PassFilter;
33 
34  /// The YAML streamer.
35  yaml::Output YAMLOutput;
36 
37 public:
38  RemarkStreamer(StringRef Filename, raw_ostream& OS);
39  /// Return the filename that the remark diagnostics are emitted to.
40  StringRef getFilename() const { return Filename; }
41  /// Return stream that the remark diagnostics are emitted to.
42  raw_ostream &getStream() { return OS; }
43  /// Set a pass filter based on a regex \p Filter.
44  /// Returns an error if the regex is invalid.
46  /// Emit a diagnostic through the streamer.
47  void emit(const DiagnosticInfoOptimizationBase &Diag);
48 };
49 } // end namespace llvm
50 
51 #endif // LLVM_IR_REMARKSTREAMER_H
Error setFilter(StringRef Filter)
Set a pass filter based on a regex Filter.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
StringRef getFilename() const
Return the filename that the remark diagnostics are emitted to.
raw_ostream & getStream()
Return stream that the remark diagnostics are emitted to.
RemarkStreamer(StringRef Filename, raw_ostream &OS)
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
Streamer for remarks.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
void emit(const DiagnosticInfoOptimizationBase &Diag)
Emit a diagnostic through the streamer.