Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Remarks/YAMLRemarkSerializer.h
Line
Count
Source
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
39
  /// Emit a remark to the stream.
40
  void emit(const Remark &Remark) override;
41
};
42
43
/// Serialize the remarks to YAML using a string table. An remark entry looks
44
/// like the regular YAML remark but instead of string entries it's using
45
/// numbers that map to an index in the string table.
46
struct YAMLStrTabSerializer : public YAMLSerializer {
47
2
  YAMLStrTabSerializer(raw_ostream &OS) : YAMLSerializer(OS) {
48
2
    // Having a string table set up enables the serializer to use it.
49
2
    StrTab.emplace();
50
2
  }
51
};
52
53
} // end namespace remarks
54
} // end namespace llvm
55
56
#endif /* LLVM_REMARKS_REMARK_SERIALIZER_H */