LLVM
22.0.0git
include
llvm
Remarks
YAMLRemarkSerializer.h
Go to the documentation of this file.
1
//===-- YAMLRemarkSerializer.h - YAML Remark serialization ---*- 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 provides an interface for serializing remarks to YAML.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_REMARKS_YAMLREMARKSERIALIZER_H
14
#define LLVM_REMARKS_YAMLREMARKSERIALIZER_H
15
16
#include "
llvm/Remarks/RemarkSerializer.h
"
17
#include "
llvm/Support/Compiler.h
"
18
#include "
llvm/Support/YAMLTraits.h
"
19
#include <optional>
20
21
namespace
llvm
{
22
namespace
remarks
{
23
24
/// Serialize the remarks to YAML. One remark entry looks like this:
25
/// --- !<TYPE>
26
/// Pass: <PASSNAME>
27
/// Name: <REMARKNAME>
28
/// DebugLoc: { File: <SOURCEFILENAME>, Line: <SOURCELINE>,
29
/// Column: <SOURCECOLUMN> }
30
/// Function: <FUNCTIONNAME>
31
/// Args:
32
/// - <KEY>: <VALUE>
33
/// DebugLoc: { File: <FILE>, Line: <LINE>, Column: <COL> }
34
/// ...
35
struct
LLVM_ABI
YAMLRemarkSerializer
:
public
RemarkSerializer
{
36
/// The YAML streamer.
37
yaml::Output
YAMLOutput
;
38
39
YAMLRemarkSerializer
(
raw_ostream
&
OS
);
40
YAMLRemarkSerializer
(
raw_ostream
&
OS
,
StringTable
StrTabIn);
41
42
void
emit
(
const
Remark
&
Remark
)
override
;
43
std::unique_ptr<MetaSerializer>
44
metaSerializer
(
raw_ostream
&
OS
,
StringRef
ExternalFilename)
override
;
45
46
static
bool
classof
(
const
RemarkSerializer
*S) {
47
return
S->
SerializerFormat
==
Format::YAML
;
48
}
49
};
50
51
struct
LLVM_ABI
YAMLMetaSerializer
:
public
MetaSerializer
{
52
StringRef
ExternalFilename
;
53
54
YAMLMetaSerializer
(
raw_ostream
&
OS
,
StringRef
ExternalFilename
)
55
:
MetaSerializer
(
OS
),
ExternalFilename
(
ExternalFilename
) {}
56
57
void
emit()
override
;
58
};
59
60
}
// end namespace remarks
61
}
// end namespace llvm
62
63
#endif
// LLVM_REMARKS_YAMLREMARKSERIALIZER_H
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition
Compiler.h:213
RemarkSerializer.h
YAMLTraits.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition
StringRef.h:55
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition
raw_ostream.h:53
llvm::yaml::Output
The Output class is used to generate a yaml document from in-memory structs and vectors.
Definition
YAMLTraits.h:1469
llvm::remarks
Definition
AsmPrinter.h:86
llvm::remarks::Format::YAML
@ YAML
Definition
RemarkFormat.h:26
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::remarks::MetaSerializer::MetaSerializer
MetaSerializer(raw_ostream &OS)
Definition
RemarkSerializer.h:66
llvm::remarks::MetaSerializer::OS
raw_ostream & OS
The open raw_ostream that the metadata is emitted to.
Definition
RemarkSerializer.h:64
llvm::remarks::RemarkSerializer::SerializerFormat
Format SerializerFormat
The format of the serializer.
Definition
RemarkSerializer.h:35
llvm::remarks::RemarkSerializer::RemarkSerializer
RemarkSerializer(Format SerializerFormat, raw_ostream &OS)
Definition
RemarkSerializer.h:42
llvm::remarks::RemarkSerializer::OS
raw_ostream & OS
The open raw_ostream that the remark diagnostics are emitted to.
Definition
RemarkSerializer.h:37
llvm::remarks::Remark
A remark type used for both emission and parsing.
Definition
Remark.h:98
llvm::remarks::StringTable
The string table used for serializing remarks.
Definition
RemarkStringTable.h:37
llvm::remarks::YAMLMetaSerializer::YAMLMetaSerializer
YAMLMetaSerializer(raw_ostream &OS, StringRef ExternalFilename)
Definition
YAMLRemarkSerializer.h:54
llvm::remarks::YAMLMetaSerializer::ExternalFilename
StringRef ExternalFilename
Definition
YAMLRemarkSerializer.h:52
llvm::remarks::YAMLRemarkSerializer::YAMLRemarkSerializer
YAMLRemarkSerializer(raw_ostream &OS)
Definition
YAMLRemarkSerializer.cpp:134
llvm::remarks::YAMLRemarkSerializer::classof
static bool classof(const RemarkSerializer *S)
Definition
YAMLRemarkSerializer.h:46
llvm::remarks::YAMLRemarkSerializer::emit
void emit(const Remark &Remark) override
Emit a remark to the stream.
Definition
YAMLRemarkSerializer.cpp:144
llvm::remarks::YAMLRemarkSerializer::YAMLOutput
yaml::Output YAMLOutput
The YAML streamer.
Definition
YAMLRemarkSerializer.h:37
llvm::remarks::YAMLRemarkSerializer::metaSerializer
std::unique_ptr< MetaSerializer > metaSerializer(raw_ostream &OS, StringRef ExternalFilename) override
Return the corresponding metadata serializer.
Definition
YAMLRemarkSerializer.cpp:152
Generated on
for LLVM by
1.14.0