Files
revng-revng/include/revng/Support/InitRevng.h
Alessandro Di Federico 4b2e067574 rcc: ban functions we wrap
2023-04-28 14:34:52 +02:00

49 lines
1.4 KiB
C++

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/PrettyStackTrace.h"
namespace revng {
/// Performs initialization and shutdown steps for revng tools.
///
/// By default this performs the regular LLVM initialization steps.
/// This is required in order to initialize the stack trace printers on signal.
class InitRevng : public llvm::InitLLVM {
public:
InitRevng(int &Argc,
auto **&Argv,
const char *Overview,
llvm::ArrayRef<const llvm::cl::OptionCategory *> CategoriesToHide) :
InitLLVM(Argc, Argv, true) {
init();
// NOLINTNEXTLINE
llvm::cl::HideUnrelatedOptions(CategoriesToHide);
// NOLINTNEXTLINE
bool Result = llvm::cl::ParseCommandLineOptions(Argc,
Argv,
Overview,
nullptr,
"REVNG_OPTIONS");
if (not Result)
std::exit(EXIT_FAILURE);
}
private:
void init() {
llvm::setBugReportMsg("PLEASE submit a bug report to "
"https://github.com/revng/revng and include the "
"crash backtrace\n");
}
};
} // namespace revng