/// \file Main.cpp /// \brief // // This file is distributed under the MIT License. See LICENSE.md for details. // #include #include "llvm/Support/CommandLine.h" #include "revng/Model/ToolHelpers.h" using namespace llvm; static cl::OptionCategory ThisToolCategory("Tool options", ""); static ModelOutputOptions Options(ThisToolCategory); static cl::opt NewModelPath(cl::Positional, cl::cat(ThisToolCategory), cl::desc(""), cl::value_desc("newmodel")); static cl::opt InputModulePath(cl::Positional, cl::cat(ThisToolCategory), cl::desc(""), cl::init("-"), cl::value_desc("module")); int main(int Argc, char *Argv[]) { cl::HideUnrelatedOptions({ &ThisToolCategory }); cl::ParseCommandLineOptions(Argc, Argv); auto OldModel = ModelInModule::loadModule(InputModulePath); auto NewModel = ModelInModule::loadYAML(NewModelPath); ExitOnError ExitOnError; if (not OldModel) ExitOnError(OldModel.takeError()); if (not NewModel) ExitOnError(NewModel.takeError()); OldModel->Model = std::move(NewModel->Model); ExitOnError(OldModel->save(Options.getPath(), Options.getDesiredOutput(OldModel->hasModule()))); }