Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Support/BinaryStreamRef.h
Line
Count
Source (jump to first uncovered line)
1
//===- BinaryStreamRef.h - A copyable reference to a stream -----*- 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
#ifndef LLVM_SUPPORT_BINARYSTREAMREF_H
10
#define LLVM_SUPPORT_BINARYSTREAMREF_H
11
12
#include "llvm/ADT/ArrayRef.h"
13
#include "llvm/ADT/Optional.h"
14
#include "llvm/Support/BinaryStream.h"
15
#include "llvm/Support/BinaryStreamError.h"
16
#include "llvm/Support/Error.h"
17
#include <algorithm>
18
#include <cstdint>
19
#include <memory>
20
21
namespace llvm {
22
23
/// Common stuff for mutable and immutable StreamRefs.
24
template <class RefType, class StreamType> class BinaryStreamRefBase {
25
protected:
26
26.2k
  BinaryStreamRefBase() = default;
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::BinaryStreamRefBase()
Line
Count
Source
26
25.8k
  BinaryStreamRefBase() = default;
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::BinaryStreamRefBase()
Line
Count
Source
26
397
  BinaryStreamRefBase() = default;
27
  explicit BinaryStreamRefBase(StreamType &BorrowedImpl)
28
41.4k
      : BorrowedImpl(&BorrowedImpl), ViewOffset(0) {
29
41.4k
    if (!(BorrowedImpl.getFlags() & BSF_Append))
30
41.0k
      Length = BorrowedImpl.getLength();
31
41.4k
  }
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::BinaryStreamRefBase(llvm::BinaryStream&)
Line
Count
Source
28
35.7k
      : BorrowedImpl(&BorrowedImpl), ViewOffset(0) {
29
35.7k
    if (!(BorrowedImpl.getFlags() & BSF_Append))
30
35.7k
      Length = BorrowedImpl.getLength();
31
35.7k
  }
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::BinaryStreamRefBase(llvm::WritableBinaryStream&)
Line
Count
Source
28
5.71k
      : BorrowedImpl(&BorrowedImpl), ViewOffset(0) {
29
5.71k
    if (!(BorrowedImpl.getFlags() & BSF_Append))
30
5.30k
      Length = BorrowedImpl.getLength();
31
5.71k
  }
32
33
  BinaryStreamRefBase(std::shared_ptr<StreamType> SharedImpl, uint32_t Offset,
34
                      Optional<uint32_t> Length)
35
      : SharedImpl(SharedImpl), BorrowedImpl(SharedImpl.get()),
36
8.25k
        ViewOffset(Offset), Length(Length) {}
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::BinaryStreamRefBase(std::__1::shared_ptr<llvm::BinaryStream>, unsigned int, llvm::Optional<unsigned int>)
Line
Count
Source
36
3.44k
        ViewOffset(Offset), Length(Length) {}
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::BinaryStreamRefBase(std::__1::shared_ptr<llvm::WritableBinaryStream>, unsigned int, llvm::Optional<unsigned int>)
Line
Count
Source
36
4.80k
        ViewOffset(Offset), Length(Length) {}
37
  BinaryStreamRefBase(StreamType &BorrowedImpl, uint32_t Offset,
38
                      Optional<uint32_t> Length)
39
2.10k
      : BorrowedImpl(&BorrowedImpl), ViewOffset(Offset), Length(Length) {}
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::BinaryStreamRefBase(llvm::BinaryStream&, unsigned int, llvm::Optional<unsigned int>)
Line
Count
Source
39
2.10k
      : BorrowedImpl(&BorrowedImpl), ViewOffset(Offset), Length(Length) {}
Unexecuted instantiation: llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::BinaryStreamRefBase(llvm::WritableBinaryStream&, unsigned int, llvm::Optional<unsigned int>)
40
222k
  BinaryStreamRefBase(const BinaryStreamRefBase &Other) = default;
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::BinaryStreamRefBase(llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream> const&)
Line
Count
Source
40
203k
  BinaryStreamRefBase(const BinaryStreamRefBase &Other) = default;
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::BinaryStreamRefBase(llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream> const&)
Line
Count
Source
40
19.3k
  BinaryStreamRefBase(const BinaryStreamRefBase &Other) = default;
41
8.55k
  BinaryStreamRefBase &operator=(const BinaryStreamRefBase &Other) = default;
42
43
36.5k
  BinaryStreamRefBase &operator=(BinaryStreamRefBase &&Other) = default;
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::operator=(llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>&&)
Line
Count
Source
43
35.3k
  BinaryStreamRefBase &operator=(BinaryStreamRefBase &&Other) = default;
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::operator=(llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>&&)
Line
Count
Source
43
1.19k
  BinaryStreamRefBase &operator=(BinaryStreamRefBase &&Other) = default;
44
60.2k
  BinaryStreamRefBase(BinaryStreamRefBase &&Other) = default;
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::BinaryStreamRefBase(llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>&&)
Line
Count
Source
44
56.7k
  BinaryStreamRefBase(BinaryStreamRefBase &&Other) = default;
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::BinaryStreamRefBase(llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>&&)
Line
Count
Source
44
3.45k
  BinaryStreamRefBase(BinaryStreamRefBase &&Other) = default;
45
46
public:
47
295k
  llvm::support::endianness getEndian() const {
48
295k
    return BorrowedImpl->getEndian();
49
295k
  }
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::getEndian() const
Line
Count
Source
47
77.1k
  llvm::support::endianness getEndian() const {
48
77.1k
    return BorrowedImpl->getEndian();
49
77.1k
  }
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::getEndian() const
Line
Count
Source
47
218k
  llvm::support::endianness getEndian() const {
48
218k
    return BorrowedImpl->getEndian();
49
218k
  }
50
51
2.00M
  uint32_t getLength() const {
52
2.00M
    if (Length.hasValue())
53
1.93M
      return *Length;
54
67.8k
55
67.8k
    return BorrowedImpl ? 
(BorrowedImpl->getLength() - ViewOffset)67.4k
:
0427
;
56
67.8k
  }
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::getLength() const
Line
Count
Source
51
1.74M
  uint32_t getLength() const {
52
1.74M
    if (Length.hasValue())
53
1.74M
      return *Length;
54
468
55
468
    return BorrowedImpl ? 
(BorrowedImpl->getLength() - ViewOffset)41
:
0427
;
56
468
  }
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::getLength() const
Line
Count
Source
51
259k
  uint32_t getLength() const {
52
259k
    if (Length.hasValue())
53
191k
      return *Length;
54
67.3k
55
67.3k
    return BorrowedImpl ? (BorrowedImpl->getLength() - ViewOffset) : 
00
;
56
67.3k
  }
57
58
  /// Return a new BinaryStreamRef with the first \p N elements removed.  If
59
  /// this BinaryStreamRef is length-tracking, then the resulting one will be
60
  /// too.
61
42.9k
  RefType drop_front(uint32_t N) const {
62
42.9k
    if (!BorrowedImpl)
63
46
      return RefType();
64
42.9k
65
42.9k
    N = std::min(N, getLength());
66
42.9k
    RefType Result(static_cast<const RefType &>(*this));
67
42.9k
    if (N == 0)
68
9.19k
      return Result;
69
33.7k
70
33.7k
    Result.ViewOffset += N;
71
33.7k
    if (Result.Length.hasValue())
72
33.7k
      *Result.Length -= N;
73
33.7k
    return Result;
74
33.7k
  }
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::drop_front(unsigned int) const
Line
Count
Source
61
40.7k
  RefType drop_front(uint32_t N) const {
62
40.7k
    if (!BorrowedImpl)
63
46
      return RefType();
64
40.6k
65
40.6k
    N = std::min(N, getLength());
66
40.6k
    RefType Result(static_cast<const RefType &>(*this));
67
40.6k
    if (N == 0)
68
8.26k
      return Result;
69
32.3k
70
32.3k
    Result.ViewOffset += N;
71
32.3k
    if (Result.Length.hasValue())
72
32.3k
      *Result.Length -= N;
73
32.3k
    return Result;
74
32.3k
  }
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::drop_front(unsigned int) const
Line
Count
Source
61
2.25k
  RefType drop_front(uint32_t N) const {
62
2.25k
    if (!BorrowedImpl)
63
0
      return RefType();
64
2.25k
65
2.25k
    N = std::min(N, getLength());
66
2.25k
    RefType Result(static_cast<const RefType &>(*this));
67
2.25k
    if (N == 0)
68
933
      return Result;
69
1.32k
70
1.32k
    Result.ViewOffset += N;
71
1.32k
    if (Result.Length.hasValue())
72
1.32k
      *Result.Length -= N;
73
1.32k
    return Result;
74
1.32k
  }
75
76
  /// Return a new BinaryStreamRef with the last \p N elements removed.  If
77
  /// this BinaryStreamRef is length-tracking and \p N is greater than 0, then
78
  /// this BinaryStreamRef will no longer length-track.
79
13.0k
  RefType drop_back(uint32_t N) const {
80
13.0k
    if (!BorrowedImpl)
81
0
      return RefType();
82
13.0k
83
13.0k
    RefType Result(static_cast<const RefType &>(*this));
84
13.0k
    N = std::min(N, getLength());
85
13.0k
86
13.0k
    if (N == 0)
87
6.74k
      return Result;
88
6.26k
89
6.26k
    // Since we're dropping non-zero bytes from the end, stop length-tracking
90
6.26k
    // by setting the length of the resulting StreamRef to an explicit value.
91
6.26k
    if (!Result.Length.hasValue())
92
1
      Result.Length = getLength();
93
6.26k
94
6.26k
    *Result.Length -= N;
95
6.26k
    return Result;
96
6.26k
  }
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::drop_back(unsigned int) const
Line
Count
Source
79
11.8k
  RefType drop_back(uint32_t N) const {
80
11.8k
    if (!BorrowedImpl)
81
0
      return RefType();
82
11.8k
83
11.8k
    RefType Result(static_cast<const RefType &>(*this));
84
11.8k
    N = std::min(N, getLength());
85
11.8k
86
11.8k
    if (N == 0)
87
6.52k
      return Result;
88
5.28k
89
5.28k
    // Since we're dropping non-zero bytes from the end, stop length-tracking
90
5.28k
    // by setting the length of the resulting StreamRef to an explicit value.
91
5.28k
    if (!Result.Length.hasValue())
92
1
      Result.Length = getLength();
93
5.28k
94
5.28k
    *Result.Length -= N;
95
5.28k
    return Result;
96
5.28k
  }
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::drop_back(unsigned int) const
Line
Count
Source
79
1.19k
  RefType drop_back(uint32_t N) const {
80
1.19k
    if (!BorrowedImpl)
81
0
      return RefType();
82
1.19k
83
1.19k
    RefType Result(static_cast<const RefType &>(*this));
84
1.19k
    N = std::min(N, getLength());
85
1.19k
86
1.19k
    if (N == 0)
87
217
      return Result;
88
978
89
978
    // Since we're dropping non-zero bytes from the end, stop length-tracking
90
978
    // by setting the length of the resulting StreamRef to an explicit value.
91
978
    if (!Result.Length.hasValue())
92
0
      Result.Length = getLength();
93
978
94
978
    *Result.Length -= N;
95
978
    return Result;
96
978
  }
97
98
  /// Return a new BinaryStreamRef with only the first \p N elements remaining.
99
13.0k
  RefType keep_front(uint32_t N) const {
100
13.0k
    assert(N <= getLength());
101
13.0k
    return drop_back(getLength() - N);
102
13.0k
  }
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::keep_front(unsigned int) const
Line
Count
Source
99
11.8k
  RefType keep_front(uint32_t N) const {
100
11.8k
    assert(N <= getLength());
101
11.8k
    return drop_back(getLength() - N);
102
11.8k
  }
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::keep_front(unsigned int) const
Line
Count
Source
99
1.19k
  RefType keep_front(uint32_t N) const {
100
1.19k
    assert(N <= getLength());
101
1.19k
    return drop_back(getLength() - N);
102
1.19k
  }
103
104
  /// Return a new BinaryStreamRef with only the last \p N elements remaining.
105
  RefType keep_back(uint32_t N) const {
106
    assert(N <= getLength());
107
    return drop_front(getLength() - N);
108
  }
109
110
  /// Return a new BinaryStreamRef with the first and last \p N elements
111
  /// removed.
112
  RefType drop_symmetric(uint32_t N) const {
113
    return drop_front(N).drop_back(N);
114
  }
115
116
  /// Return a new BinaryStreamRef with the first \p Offset elements removed,
117
  /// and retaining exactly \p Len elements.
118
11.1k
  RefType slice(uint32_t Offset, uint32_t Len) const {
119
11.1k
    return drop_front(Offset).keep_front(Len);
120
11.1k
  }
121
122
  bool valid() const { return BorrowedImpl != nullptr; }
123
124
1.22k
  bool operator==(const RefType &Other) const {
125
1.22k
    if (BorrowedImpl != Other.BorrowedImpl)
126
0
      return false;
127
1.22k
    if (ViewOffset != Other.ViewOffset)
128
0
      return false;
129
1.22k
    if (Length != Other.Length)
130
0
      return false;
131
1.22k
    return true;
132
1.22k
  }
133
134
protected:
135
825k
  Error checkOffsetForRead(uint32_t Offset, uint32_t DataSize) const {
136
825k
    if (Offset > getLength())
137
6
      return make_error<BinaryStreamError>(stream_error_code::invalid_offset);
138
825k
    if (getLength() < DataSize + Offset)
139
486
      return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
140
824k
    return Error::success();
141
824k
  }
llvm::BinaryStreamRefBase<llvm::WritableBinaryStreamRef, llvm::WritableBinaryStream>::checkOffsetForRead(unsigned int, unsigned int) const
Line
Count
Source
135
91.6k
  Error checkOffsetForRead(uint32_t Offset, uint32_t DataSize) const {
136
91.6k
    if (Offset > getLength())
137
0
      return make_error<BinaryStreamError>(stream_error_code::invalid_offset);
138
91.6k
    if (getLength() < DataSize + Offset)
139
12
      return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
140
91.6k
    return Error::success();
141
91.6k
  }
llvm::BinaryStreamRefBase<llvm::BinaryStreamRef, llvm::BinaryStream>::checkOffsetForRead(unsigned int, unsigned int) const
Line
Count
Source
135
733k
  Error checkOffsetForRead(uint32_t Offset, uint32_t DataSize) const {
136
733k
    if (Offset > getLength())
137
6
      return make_error<BinaryStreamError>(stream_error_code::invalid_offset);
138
733k
    if (getLength() < DataSize + Offset)
139
474
      return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
140
733k
    return Error::success();
141
733k
  }
142
143
  std::shared_ptr<StreamType> SharedImpl;
144
  StreamType *BorrowedImpl = nullptr;
145
  uint32_t ViewOffset = 0;
146
  Optional<uint32_t> Length;
147
};
148
149
/// BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.  It
150
/// provides copy-semantics and read only access to a "window" of the underlying
151
/// BinaryStream. Note that BinaryStreamRef is *not* a BinaryStream.  That is to
152
/// say, it does not inherit and override the methods of BinaryStream.  In
153
/// general, you should not pass around pointers or references to BinaryStreams
154
/// and use inheritance to achieve polymorphism.  Instead, you should pass
155
/// around BinaryStreamRefs by value and achieve polymorphism that way.
156
class BinaryStreamRef
157
    : public BinaryStreamRefBase<BinaryStreamRef, BinaryStream> {
158
  friend BinaryStreamRefBase<BinaryStreamRef, BinaryStream>;
159
  friend class WritableBinaryStreamRef;
160
  BinaryStreamRef(std::shared_ptr<BinaryStream> Impl, uint32_t ViewOffset,
161
                  Optional<uint32_t> Length)
162
0
      : BinaryStreamRefBase(Impl, ViewOffset, Length) {}
163
164
public:
165
25.8k
  BinaryStreamRef() = default;
166
  BinaryStreamRef(BinaryStream &Stream);
167
  BinaryStreamRef(BinaryStream &Stream, uint32_t Offset,
168
                  Optional<uint32_t> Length);
169
  explicit BinaryStreamRef(ArrayRef<uint8_t> Data,
170
                           llvm::support::endianness Endian);
171
  explicit BinaryStreamRef(StringRef Data, llvm::support::endianness Endian);
172
173
203k
  BinaryStreamRef(const BinaryStreamRef &Other) = default;
174
8.55k
  BinaryStreamRef &operator=(const BinaryStreamRef &Other) = default;
175
56.7k
  BinaryStreamRef(BinaryStreamRef &&Other) = default;
176
35.3k
  BinaryStreamRef &operator=(BinaryStreamRef &&Other) = default;
177
178
  // Use BinaryStreamRef.slice() instead.
179
  BinaryStreamRef(BinaryStreamRef &S, uint32_t Offset,
180
                  uint32_t Length) = delete;
181
182
  /// Given an Offset into this StreamRef and a Size, return a reference to a
183
  /// buffer owned by the stream.
184
  ///
185
  /// \returns a success error code if the entire range of data is within the
186
  /// bounds of this BinaryStreamRef's view and the implementation could read
187
  /// the data, and an appropriate error code otherwise.
188
  Error readBytes(uint32_t Offset, uint32_t Size,
189
                  ArrayRef<uint8_t> &Buffer) const;
190
191
  /// Given an Offset into this BinaryStreamRef, return a reference to the
192
  /// largest buffer the stream could support without necessitating a copy.
193
  ///
194
  /// \returns a success error code if implementation could read the data,
195
  /// and an appropriate error code otherwise.
196
  Error readLongestContiguousChunk(uint32_t Offset,
197
                                   ArrayRef<uint8_t> &Buffer) const;
198
};
199
200
struct BinarySubstreamRef {
201
  uint32_t Offset;            // Offset in the parent stream
202
  BinaryStreamRef StreamData; // Stream Data
203
204
  BinarySubstreamRef slice(uint32_t Off, uint32_t Size) const {
205
    BinaryStreamRef SubSub = StreamData.slice(Off, Size);
206
    return {Off + Offset, SubSub};
207
  }
208
  BinarySubstreamRef drop_front(uint32_t N) const {
209
    return slice(N, size() - N);
210
  }
211
  BinarySubstreamRef keep_front(uint32_t N) const { return slice(0, N); }
212
213
  std::pair<BinarySubstreamRef, BinarySubstreamRef>
214
  split(uint32_t Offset) const {
215
    return std::make_pair(keep_front(Offset), drop_front(Offset));
216
  }
217
218
  uint32_t size() const { return StreamData.getLength(); }
219
  bool empty() const { return size() == 0; }
220
};
221
222
class WritableBinaryStreamRef
223
    : public BinaryStreamRefBase<WritableBinaryStreamRef,
224
                                 WritableBinaryStream> {
225
  friend BinaryStreamRefBase<WritableBinaryStreamRef, WritableBinaryStream>;
226
  WritableBinaryStreamRef(std::shared_ptr<WritableBinaryStream> Impl,
227
                          uint32_t ViewOffset, Optional<uint32_t> Length)
228
0
      : BinaryStreamRefBase(Impl, ViewOffset, Length) {}
229
230
158k
  Error checkOffsetForWrite(uint32_t Offset, uint32_t DataSize) const {
231
158k
    if (!(BorrowedImpl->getFlags() & BSF_Append))
232
91.6k
      return checkOffsetForRead(Offset, DataSize);
233
67.3k
234
67.3k
    if (Offset > getLength())
235
0
      return make_error<BinaryStreamError>(stream_error_code::invalid_offset);
236
67.3k
    return Error::success();
237
67.3k
  }
238
239
public:
240
397
  WritableBinaryStreamRef() = default;
241
  WritableBinaryStreamRef(WritableBinaryStream &Stream);
242
  WritableBinaryStreamRef(WritableBinaryStream &Stream, uint32_t Offset,
243
                          Optional<uint32_t> Length);
244
  explicit WritableBinaryStreamRef(MutableArrayRef<uint8_t> Data,
245
                                   llvm::support::endianness Endian);
246
19.3k
  WritableBinaryStreamRef(const WritableBinaryStreamRef &Other) = default;
247
  WritableBinaryStreamRef &
248
  operator=(const WritableBinaryStreamRef &Other) = default;
249
250
3.45k
  WritableBinaryStreamRef(WritableBinaryStreamRef &&Other) = default;
251
1.19k
  WritableBinaryStreamRef &operator=(WritableBinaryStreamRef &&Other) = default;
252
253
  // Use WritableBinaryStreamRef.slice() instead.
254
  WritableBinaryStreamRef(WritableBinaryStreamRef &S, uint32_t Offset,
255
                          uint32_t Length) = delete;
256
257
  /// Given an Offset into this WritableBinaryStreamRef and some input data,
258
  /// writes the data to the underlying stream.
259
  ///
260
  /// \returns a success error code if the data could fit within the underlying
261
  /// stream at the specified location and the implementation could write the
262
  /// data, and an appropriate error code otherwise.
263
  Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const;
264
265
  /// Conver this WritableBinaryStreamRef to a read-only BinaryStreamRef.
266
  operator BinaryStreamRef() const;
267
268
  /// For buffered streams, commits changes to the backing store.
269
  Error commit();
270
};
271
272
} // end namespace llvm
273
274
#endif // LLVM_SUPPORT_BINARYSTREAMREF_H