99#ifndef LLVM_SUPPORT_BINARYSTREAMREADER_H
1010#define LLVM_SUPPORT_BINARYSTREAMREADER_H
1111
12+ #include " llvm/Support/Compiler.h"
1213#include " llvm/ADT/ArrayRef.h"
1314#include " llvm/ADT/StringRef.h"
1415#include " llvm/Support/Alignment.h"
@@ -29,10 +30,10 @@ namespace llvm {
2930class BinaryStreamReader {
3031public:
3132 BinaryStreamReader () = default ;
32- explicit BinaryStreamReader (BinaryStreamRef Ref);
33- explicit BinaryStreamReader (BinaryStream &Stream);
34- explicit BinaryStreamReader (ArrayRef<uint8_t > Data, llvm::endianness Endian);
35- explicit BinaryStreamReader (StringRef Data, llvm::endianness Endian);
33+ LLVM_ABI explicit BinaryStreamReader (BinaryStreamRef Ref);
34+ LLVM_ABI explicit BinaryStreamReader (BinaryStream &Stream);
35+ LLVM_ABI explicit BinaryStreamReader (ArrayRef<uint8_t > Data, llvm::endianness Endian);
36+ LLVM_ABI explicit BinaryStreamReader (StringRef Data, llvm::endianness Endian);
3637
3738 BinaryStreamReader (const BinaryStreamReader &Other) = default ;
3839
@@ -46,7 +47,7 @@ class BinaryStreamReader {
4647 // /
4748 // / \returns a success error code if the data was successfully read, otherwise
4849 // / returns an appropriate error code.
49- Error readLongestContiguousChunk (ArrayRef<uint8_t > &Buffer);
50+ LLVM_ABI Error readLongestContiguousChunk (ArrayRef<uint8_t > &Buffer);
5051
5152 // / Read \p Size bytes from the underlying stream at the current offset and
5253 // / and set \p Buffer to the resulting data slice. Whether a copy occurs
@@ -55,7 +56,7 @@ class BinaryStreamReader {
5556 // /
5657 // / \returns a success error code if the data was successfully read, otherwise
5758 // / returns an appropriate error code.
58- Error readBytes (ArrayRef<uint8_t > &Buffer, uint32_t Size);
59+ LLVM_ABI Error readBytes (ArrayRef<uint8_t > &Buffer, uint32_t Size);
5960
6061 // / Read an integer of the specified endianness into \p Dest and update the
6162 // / stream's offset. The data is always copied from the stream's underlying
@@ -91,44 +92,44 @@ class BinaryStreamReader {
9192 // /
9293 // / \returns a success error code if the data was successfully read, otherwise
9394 // / returns an appropriate error code.
94- Error readULEB128 (uint64_t &Dest);
95+ LLVM_ABI Error readULEB128 (uint64_t &Dest);
9596
9697 // / Read a signed LEB128 encoded value.
9798 // /
9899 // / \returns a success error code if the data was successfully read, otherwise
99100 // / returns an appropriate error code.
100- Error readSLEB128 (int64_t &Dest);
101+ LLVM_ABI Error readSLEB128 (int64_t &Dest);
101102
102103 // / Read a null terminated string from \p Dest. Whether a copy occurs depends
103104 // / on the implementation of the underlying stream. Updates the stream's
104105 // / offset to point after the newly read data.
105106 // /
106107 // / \returns a success error code if the data was successfully read, otherwise
107108 // / returns an appropriate error code.
108- Error readCString (StringRef &Dest);
109+ LLVM_ABI Error readCString (StringRef &Dest);
109110
110111 // / Similar to readCString, however read a null-terminated UTF16 string
111112 // / instead.
112113 // /
113114 // / \returns a success error code if the data was successfully read, otherwise
114115 // / returns an appropriate error code.
115- Error readWideString (ArrayRef<UTF16> &Dest);
116+ LLVM_ABI Error readWideString (ArrayRef<UTF16> &Dest);
116117
117118 // / Read a \p Length byte string into \p Dest. Whether a copy occurs depends
118119 // / on the implementation of the underlying stream. Updates the stream's
119120 // / offset to point after the newly read data.
120121 // /
121122 // / \returns a success error code if the data was successfully read, otherwise
122123 // / returns an appropriate error code.
123- Error readFixedString (StringRef &Dest, uint32_t Length);
124+ LLVM_ABI Error readFixedString (StringRef &Dest, uint32_t Length);
124125
125126 // / Read the entire remainder of the underlying stream into \p Ref. This is
126127 // / equivalent to calling getUnderlyingStream().slice(Offset). Updates the
127128 // / stream's offset to point to the end of the stream. Never causes a copy.
128129 // /
129130 // / \returns a success error code if the data was successfully read, otherwise
130131 // / returns an appropriate error code.
131- Error readStreamRef (BinaryStreamRef &Ref);
132+ LLVM_ABI Error readStreamRef (BinaryStreamRef &Ref);
132133
133134 // / Read \p Length bytes from the underlying stream into \p Ref. This is
134135 // / equivalent to calling getUnderlyingStream().slice(Offset, Length).
@@ -137,7 +138,7 @@ class BinaryStreamReader {
137138 // /
138139 // / \returns a success error code if the data was successfully read, otherwise
139140 // / returns an appropriate error code.
140- Error readStreamRef (BinaryStreamRef &Ref, uint32_t Length);
141+ LLVM_ABI Error readStreamRef (BinaryStreamRef &Ref, uint32_t Length);
141142
142143 // / Read \p Length bytes from the underlying stream into \p Ref. This is
143144 // / equivalent to calling getUnderlyingStream().slice(Offset, Length).
@@ -146,7 +147,7 @@ class BinaryStreamReader {
146147 // /
147148 // / \returns a success error code if the data was successfully read, otherwise
148149 // / returns an appropriate error code.
149- Error readSubstream (BinarySubstreamRef &Ref, uint32_t Length);
150+ LLVM_ABI Error readSubstream (BinarySubstreamRef &Ref, uint32_t Length);
150151
151152 // / Get a pointer to an object of type T from the underlying stream, as if by
152153 // / memcpy, and store the result into \p Dest. It is up to the caller to
@@ -251,17 +252,17 @@ class BinaryStreamReader {
251252 // /
252253 // / \returns a success error code if at least \p Amount bytes remain in the
253254 // / stream, otherwise returns an appropriate error code.
254- Error skip (uint64_t Amount);
255+ LLVM_ABI Error skip (uint64_t Amount);
255256
256257 // / Examine the next byte of the underlying stream without advancing the
257258 // / stream's offset. If the stream is empty the behavior is undefined.
258259 // /
259260 // / \returns the next byte in the stream.
260- uint8_t peek () const ;
261+ LLVM_ABI uint8_t peek () const ;
261262
262- Error padToAlignment (uint32_t Align);
263+ LLVM_ABI Error padToAlignment (uint32_t Align);
263264
264- std::pair<BinaryStreamReader, BinaryStreamReader>
265+ LLVM_ABI std::pair<BinaryStreamReader, BinaryStreamReader>
265266 split (uint64_t Offset) const ;
266267
267268private:
0 commit comments