summaryrefslogtreecommitdiff
path: root/Driver.cc
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-12 01:52:49 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-12 01:52:49 +0800
commitf146dac784325c9403499046f52f70e3596ae345 (patch)
tree4af8b76cbf83892d3cbfdda7a4b17fa8af34b4a0 /Driver.cc
initial commit
Diffstat (limited to 'Driver.cc')
-rw-r--r--Driver.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/Driver.cc b/Driver.cc
new file mode 100644
index 0000000..3fefd8c
--- /dev/null
+++ b/Driver.cc
@@ -0,0 +1,21 @@
+#include "Driver.hh"
+
+namespace pcc {
+Driver::Driver(Context* context)
+ : context_(context) {}
+
+Driver::~Driver() {}
+
+void Driver::Parse(const std::string& filename) {
+ if (StartLexer(filename) != 0) {
+ return;
+ }
+ Parser parser(*this);
+ parser.parse();
+ StopLexer();
+}
+
+llvm::Module* Driver::GetModule() { return &context_->module_; }
+
+llvm::IRBuilder<>* Driver::GetBuilder() { return &context_->builder_; }
+} // namespace pcc