Files
revng-revng/tools/model/dump/Main.cpp
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00

43 lines
1.3 KiB
C++

/// \file Main.cpp
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include <string>
#include "llvm/Support/CommandLine.h"
#include "revng/Model/ToolHelpers.h"
#include "revng/Support/InitRevng.h"
using namespace llvm;
static cl::OptionCategory ThisToolCategory("Tool options", "");
cl::opt<std::string> OutputFilename("o",
cl::cat(ThisToolCategory),
cl::desc("Override output filename"),
cl::init("-"),
cl::value_desc("filename"));
static cl::opt<std::string> InputModulePath(cl::Positional,
cl::cat(ThisToolCategory),
cl::desc("<input module file>"),
cl::init("-"),
cl::value_desc("module"));
int main(int Argc, char *Argv[]) {
revng::InitRevng X(Argc, Argv, "", { &ThisToolCategory });
ExitOnError ExitOnError;
auto MaybeModel = ModelInModule::load(InputModulePath);
if (not MaybeModel)
ExitOnError(MaybeModel.takeError());
ExitOnError(MaybeModel->save(OutputFilename, ModelOutputType::YAML));
return EXIT_SUCCESS;
}