diff options
| author | Ralf Jung <post@ralfj.de> | 2025-07-27 15:08:54 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-27 15:08:54 +0000 |
| commit | c751579b2fde59dc647a4fe997468c099730be5e (patch) | |
| tree | 5bb2ed8204cff678c7448efe4c743a609b078014 /src/tools/miri/genmc-sys/src_cpp/MiriInterface.hpp | |
| parent | b59c40eed48574473d752171988ec4797c48ab13 (diff) | |
| parent | 87b8cb06c793620f1f66291200aea1b9bd8c3d89 (diff) | |
Merge pull request #4498 from RalfJung/genmc-build
Add support for building and linking against genmc
Diffstat (limited to 'src/tools/miri/genmc-sys/src_cpp/MiriInterface.hpp')
| -rw-r--r-- | src/tools/miri/genmc-sys/src_cpp/MiriInterface.hpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tools/miri/genmc-sys/src_cpp/MiriInterface.hpp b/src/tools/miri/genmc-sys/src_cpp/MiriInterface.hpp new file mode 100644 index 00000000000..e55522ef418 --- /dev/null +++ b/src/tools/miri/genmc-sys/src_cpp/MiriInterface.hpp @@ -0,0 +1,44 @@ +#ifndef GENMC_MIRI_INTERFACE_HPP +#define GENMC_MIRI_INTERFACE_HPP + +#include "rust/cxx.h" + +#include "config.h" + +#include "Config/Config.hpp" +#include "Verification/GenMCDriver.hpp" + +#include <iostream> + +/**** Types available to Miri ****/ + +// Config struct defined on the Rust side and translated to C++ by cxx.rs: +struct GenmcParams; + +struct MiriGenMCShim : private GenMCDriver +{ + +public: + MiriGenMCShim(std::shared_ptr<const Config> conf, Mode mode /* = VerificationMode{} */) + : GenMCDriver(std::move(conf), nullptr, mode) + { + std::cerr << "C++: GenMC handle created!" << std::endl; + } + + virtual ~MiriGenMCShim() + { + std::cerr << "C++: GenMC handle destroyed!" << std::endl; + } + + static std::unique_ptr<MiriGenMCShim> createHandle(const GenmcParams &config); +}; + +/**** Functions available to Miri ****/ + +// NOTE: CXX doesn't support exposing static methods to Rust currently, so we expose this function instead. +static inline auto createGenmcHandle(const GenmcParams &config) -> std::unique_ptr<MiriGenMCShim> +{ + return MiriGenMCShim::createHandle(config); +} + +#endif /* GENMC_MIRI_INTERFACE_HPP */ |
