// Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. #pragma once #include #include #include #include #include #include #include #include #include #include namespace hilti::detail::cxx { /** * HILTI's linker. * * It's not *really* a linker, it's a component that adds additional C++ code * requires knowledge across all compilation units. */ class Linker { public: Linker(CodeGen* cg) : _codegen(cg) {} void add(const linker::MetaData& md); void finalize(); Result> linkerUnit(); // only after finalize and at least one module private: CodeGen* _codegen; std::shared_ptr _linker_unit; std::set> _modules; std::map> _joins; std::set _globals; }; } // namespace hilti::detail::cxx