summaryrefslogtreecommitdiff
path: root/willow/tools/willowc/include/sourcemanager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'willow/tools/willowc/include/sourcemanager.hpp')
-rw-r--r--willow/tools/willowc/include/sourcemanager.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/willow/tools/willowc/include/sourcemanager.hpp b/willow/tools/willowc/include/sourcemanager.hpp
new file mode 100644
index 0000000..a526e48
--- /dev/null
+++ b/willow/tools/willowc/include/sourcemanager.hpp
@@ -0,0 +1,26 @@
+#ifndef WILLOWC_INCLUDE_SOURCEMANAGER_HPP
+#define WILLOWC_INCLUDE_SOURCEMANAGER_HPP
+
+#include <filesystem>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace willowc {
+
+using FileID = std::uint32_t;
+
+class SourceManager {
+struct File {
+ std::string path;
+ std::unique_ptr<char[]> buf;
+};
+public:
+ std::optional<FileID> addFile(std::string_view path);
+private:
+ std::vector<File> file_table;
+};
+
+} // namespace willowc
+
+#endif // WILLOWC_INCLUDE_SOURCEMANAGER_HPP