#pragma once // // This file is distributed under the MIT License. See LICENSE.md for details. // #include #include "llvm/Support/Error.h" #include "revng/PipeboxCommon/Common.h" #include "revng/PipeboxCommon/Concepts.h" #include "revng/PipeboxCommon/Helpers/Helpers.h" #include "revng/PipeboxCommon/Model.h" namespace revng::pypeline::helpers { /// Helper function that allows running an analysis, deals with unpacking the /// container list to multiple parameters that will be passed to the run /// function to of the Analysis. template inline llvm::Error runAnalysis(T &Analysis, Model &TheModel, const Request &Incoming, llvm::StringRef Configuration, std::tuple &Containers) { using Traits = AnalysisRunTraits; revng_assert(Incoming.size() == Traits::ContainerCount); using CT = Traits::ContainerTypes; return compile_time::callWithIndexSequence([&]() { return Analysis.run(TheModel, Incoming, Configuration, std::get(Containers)...); }); } } // namespace revng::pypeline::helpers