Spicy
driver.h
1 // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <memory>
6 #include <string>
7 #include <utility>
8 
9 #include <hilti/compiler/driver.h>
10 
11 namespace spicy {
12 
16 struct Options {
17  bool track_offsets = false;
18 };
19 
29 class Driver : public hilti::Driver {
30 public:
35  explicit Driver(std::string name) : hilti::Driver(std::move(name)) {}
36 
44  Driver(std::string name, const hilti::rt::filesystem::path& argv0) : hilti::Driver(std::move(name), argv0) {}
45 
46  ~Driver() override {}
47 
48  Driver() = delete;
49  Driver(const Driver&) = delete;
50  Driver(Driver&&) noexcept = delete;
51  Driver& operator=(const Driver&) = delete;
52  Driver& operator=(Driver&&) noexcept = delete;
53 
55  spicy::Options spicyCompilerOptions() const;
56 
62  void setSpicyCompilerOptions(const spicy::Options& options);
63 
64 protected:
65  std::unique_ptr<hilti::Builder> createBuilder(hilti::ASTContext* ctx) const override;
66 
67  std::string hookAddCommandLineOptions() override;
68  bool hookProcessCommandLineOption(int opt, const char* optarg) override;
69  std::string hookAugmentUsage() override;
70 
71 private:
72  spicy::Options _compiler_options;
73 };
74 
75 } // namespace spicy
Definition: driver.h:85
const auto & options() const
Definition: driver.h:232
Definition: driver.h:29
bool hookProcessCommandLineOption(int opt, const char *optarg) override
Definition: driver.cc:28
void setSpicyCompilerOptions(const spicy::Options &options)
Definition: driver.cc:16
spicy::Options spicyCompilerOptions() const
Definition: driver.cc:8
Driver(std::string name)
Definition: driver.h:35
std::string hookAugmentUsage() override
Definition: driver.cc:40
Driver(std::string name, const hilti::rt::filesystem::path &argv0)
Definition: driver.h:44
std::unique_ptr< hilti::Builder > createBuilder(hilti::ASTContext *ctx) const override
Definition: driver.cc:22
std::string hookAddCommandLineOptions() override
Definition: driver.cc:26
Definition: driver.h:16
bool track_offsets
Definition: driver.h:17