Skip to content

Commit cbbdc41

Browse files
committed
[Remarks][NFC] Move the YAML serializer to its own header
llvm-svn: 366842
1 parent 41a010a commit cbbdc41

File tree

5 files changed

+50
-25
lines changed

5 files changed

+50
-25
lines changed

llvm/include/llvm/Remarks/RemarkSerializer.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include "llvm/Remarks/Remark.h"
1717
#include "llvm/Remarks/RemarkStringTable.h"
18-
#include "llvm/Support/YAMLTraits.h"
1918
#include "llvm/Support/raw_ostream.h"
2019

2120
namespace llvm {
@@ -40,28 +39,6 @@ struct Serializer {
4039
/// Wether the serializer should use a string table while emitting.
4140
enum class UseStringTable { No, Yes };
4241

43-
/// Serialize the remarks to YAML. One remark entry looks like this:
44-
/// --- !<TYPE>
45-
/// Pass: <PASSNAME>
46-
/// Name: <REMARKNAME>
47-
/// DebugLoc: { File: <SOURCEFILENAME>, Line: <SOURCELINE>,
48-
/// Column: <SOURCECOLUMN> }
49-
/// Function: <FUNCTIONNAME>
50-
/// Args:
51-
/// - <KEY>: <VALUE>
52-
/// DebugLoc: { File: <FILE>, Line: <LINE>, Column: <COL> }
53-
/// ...
54-
struct YAMLSerializer : public Serializer {
55-
/// The YAML streamer.
56-
yaml::Output YAMLOutput;
57-
58-
YAMLSerializer(raw_ostream &OS,
59-
UseStringTable UseStringTable = remarks::UseStringTable::No);
60-
61-
/// Emit a remark to the stream.
62-
void emit(const Remark &Remark) override;
63-
};
64-
6542
} // end namespace remarks
6643
} // end namespace llvm
6744

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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_YAML_REMARK_SERIALIZER_H
14+
#define LLVM_REMARKS_YAML_REMARK_SERIALIZER_H
15+
16+
#include "llvm/Remarks/RemarkSerializer.h"
17+
#include "llvm/Support/YAMLTraits.h"
18+
19+
namespace llvm {
20+
namespace remarks {
21+
22+
/// Serialize the remarks to YAML. One remark entry looks like this:
23+
/// --- !<TYPE>
24+
/// Pass: <PASSNAME>
25+
/// Name: <REMARKNAME>
26+
/// DebugLoc: { File: <SOURCEFILENAME>, Line: <SOURCELINE>,
27+
/// Column: <SOURCECOLUMN> }
28+
/// Function: <FUNCTIONNAME>
29+
/// Args:
30+
/// - <KEY>: <VALUE>
31+
/// DebugLoc: { File: <FILE>, Line: <LINE>, Column: <COL> }
32+
/// ...
33+
struct YAMLSerializer : public Serializer {
34+
/// The YAML streamer.
35+
yaml::Output YAMLOutput;
36+
37+
YAMLSerializer(raw_ostream &OS,
38+
UseStringTable UseStringTable = remarks::UseStringTable::No);
39+
40+
/// Emit a remark to the stream.
41+
void emit(const Remark &Remark) override;
42+
};
43+
44+
} // end namespace remarks
45+
} // end namespace llvm
46+
47+
#endif /* LLVM_REMARKS_REMARK_SERIALIZER_H */

llvm/lib/IR/RemarkStreamer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/IR/Function.h"
1717
#include "llvm/IR/GlobalValue.h"
1818
#include "llvm/Remarks/RemarkFormat.h"
19+
#include "llvm/Remarks/YAMLRemarkSerializer.h"
1920

2021
using namespace llvm;
2122

llvm/lib/Remarks/YAMLRemarkSerializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#include "llvm/Remarks/RemarkSerializer.h"
14+
#include "llvm/Remarks/YAMLRemarkSerializer.h"
1515
#include "llvm/Support/CommandLine.h"
1616

1717
using namespace llvm;

llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "llvm/Remarks/Remark.h"
10-
#include "llvm/Remarks/RemarkSerializer.h"
10+
#include "llvm/Remarks/YAMLRemarkSerializer.h"
1111
#include "gtest/gtest.h"
1212

1313
using namespace llvm;

0 commit comments

Comments
 (0)