Create the skeleton of the C++ -> Rust migration tool.
PiperOrigin-RevId: 448016954
diff --git a/common/file_io.cc b/common/file_io.cc
index 2975dd3..613b642 100644
--- a/common/file_io.cc
+++ b/common/file_io.cc
@@ -4,10 +4,21 @@
#include "common/file_io.h"
+#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
namespace crubit {
+absl::StatusOr<std::string> GetFileContents(absl::string_view path) {
+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> err_or_buffer =
+ llvm::MemoryBuffer::getFileOrSTDIN(path.data(), /* IsText= */ true);
+ if (std::error_code err = err_or_buffer.getError()) {
+ return absl::Status(absl::StatusCode::kInternal, err.message());
+ }
+
+ return std::string((*err_or_buffer)->getBuffer());
+}
+
absl::Status SetFileContents(absl::string_view path,
absl::string_view contents) {
std::error_code error_code;