P4C
The P4 Compiler
Loading...
Searching...
No Matches
backends/p4tools/common/options.h
1#ifndef BACKENDS_P4TOOLS_COMMON_OPTIONS_H_
2#define BACKENDS_P4TOOLS_COMMON_OPTIONS_H_
3
4#include <cstdint>
5#include <optional>
6#include <tuple>
7#include <vector>
8
9#include "frontends/common/options.h"
10#include "lib/compile_context.h"
11
12namespace P4::P4Tools {
13
18 private:
20 std::string _toolName;
21
22 public:
23 virtual ~AbstractP4cToolOptions() = default;
25 std::optional<uint32_t> seed = std::nullopt;
26
29
33 int process(const std::vector<const char *> &args);
34
36 std::vector<const char *> compilerArgs;
37
39 std::vector<const char *> *process(int argc, char *const argv[]) override;
40
41 protected:
42 // Self-assignments and copy constructor can only be used by other options.
43 AbstractP4cToolOptions &operator=(const AbstractP4cToolOptions &) = default;
46
47 [[nodiscard]] bool validateOptions() const override;
48
50 [[nodiscard]] const std::string &getToolName() const;
51
53 static std::tuple<int, char **> convertArgs(const std::vector<const char *> &args);
54
55 explicit AbstractP4cToolOptions(std::string_view toolName, std::string_view message);
56};
57
58} // namespace P4::P4Tools
59
60#endif /* BACKENDS_P4TOOLS_COMMON_OPTIONS_H_ */
Definition frontends/common/options.h:30
Definition backends/p4tools/common/options.h:17
const std::string & getToolName() const
The name of the tool associated with these options.
Definition backends/p4tools/common/options.cpp:78
bool validateOptions() const override
Definition backends/p4tools/common/options.cpp:76
std::optional< uint32_t > seed
A seed for the PRNG.
Definition backends/p4tools/common/options.h:25
static std::tuple< int, char ** > convertArgs(const std::vector< const char * > &args)
Converts a vector of command-line arguments into the traditional (argc, argv) format.
Definition backends/p4tools/common/options.cpp:18
std::vector< const char * > compilerArgs
Command-line arguments to be sent to the compiler. Populated by @process.
Definition backends/p4tools/common/options.h:36
int process(const std::vector< const char * > &args)
Definition backends/p4tools/common/options.cpp:28
bool disableInformationLogging
Disable information logging.
Definition backends/p4tools/common/options.h:28
Definition common/compiler/compiler_result.cpp:3