mini-llvm 0.1.0
Loading...
Searching...
No Matches
IO.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <cstddef>
6#include <cstdio>
7#include <string>
8#include <string_view>
9
14
15namespace mini_llvm {
16
20
21MINI_LLVM_EXPORT Expected<void, SystemError> writeAll(FILE *stream, const char *data, size_t size);
22MINI_LLVM_EXPORT Expected<void, SystemError> writeAll(const Path &path, const char *data, size_t size);
23MINI_LLVM_EXPORT Expected<void, SystemError> writeAll(const Path &path, FILE *stream, const char *data, size_t size);
24
25inline Expected<void, SystemError> writeAll(FILE *stream, std::string_view buffer) {
26 return writeAll(stream, buffer.data(), buffer.size());
27}
28
29inline Expected<void, SystemError> writeAll(const Path &path, std::string_view buffer) {
30 return writeAll(path, buffer.data(), buffer.size());
31}
32
33inline Expected<void, SystemError> writeAll(const Path &path, FILE *stream, std::string_view buffer) {
34 return writeAll(path, stream, buffer.data(), buffer.size());
35}
36
37} // namespace mini_llvm
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
Definition Expected.h:65
Definition Path.h:18
Definition GraphColoringAllocator.h:13
MINI_LLVM_EXPORT Expected< void, SystemError > writeAll(FILE *stream, const char *data, size_t size)
MINI_LLVM_EXPORT Expected< std::string, SystemError > readAll(FILE *stream)