1 //===--------- llvm-remarkutil/RemarkUtil.cpp -----------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
8 /// Utility for remark files.
9 //===----------------------------------------------------------------------===//
11 #include "RemarkUtilRegistry.h"
12 #include "llvm/Support/InitLLVM.h"
15 using namespace llvm::remarkutil
;
16 ExitOnError ExitOnErr
;
18 static Error
handleSubOptions() {
19 for (auto *SC
: cl::getRegisteredSubcommands()) {
21 // If no subcommand was provided, we need to explicitly check if this is
22 // the top-level subcommand.
23 if (SC
== &cl::SubCommand::getTopLevel())
25 if (auto C
= dispatch(SC
)) {
31 return make_error
<StringError
>(
32 "Please specify a subcommand. (See -help for options)",
33 inconvertibleErrorCode());
36 int main(int argc
, char *argv
[]) {
37 InitLLVM
X(argc
, argv
);
38 cl::ParseCommandLineOptions(argc
, argv
, "Remark file utilities\n");
39 ExitOnErr
.setBanner(std::string(argv
[0]) + ": error: ");
40 ExitOnErr(handleSubOptions());