/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Remarks/RemarkSerializer.h
Line | Count | Source |
1 | | //===-- RemarkSerializer.h - Remark serialization interface -----*- 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 different formats. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_REMARKS_REMARK_SERIALIZER_H |
14 | | #define LLVM_REMARKS_REMARK_SERIALIZER_H |
15 | | |
16 | | #include "llvm/Remarks/Remark.h" |
17 | | #include "llvm/Remarks/RemarkStringTable.h" |
18 | | #include "llvm/Support/raw_ostream.h" |
19 | | |
20 | | namespace llvm { |
21 | | namespace remarks { |
22 | | |
23 | | /// This is the base class for a remark serializer. |
24 | | /// It includes support for using a string table while emitting. |
25 | | struct Serializer { |
26 | | /// The open raw_ostream that the remark diagnostics are emitted to. |
27 | | raw_ostream &OS; |
28 | | /// The string table containing all the unique strings used in the output. |
29 | | /// The table can be serialized to be consumed after the compilation. |
30 | | Optional<StringTable> StrTab; |
31 | | |
32 | 93 | Serializer(raw_ostream &OS) : OS(OS), StrTab() {} |
33 | | |
34 | | /// This is just an interface. |
35 | 92 | virtual ~Serializer() = default; |
36 | | virtual void emit(const Remark &Remark) = 0; |
37 | | }; |
38 | | |
39 | | } // end namespace remarks |
40 | | } // end namespace llvm |
41 | | |
42 | | #endif /* LLVM_REMARKS_REMARK_SERIALIZER_H */ |