aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/tools/llvm-remarkutil/RemarkUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-remarkutil/RemarkUtil.cpp')
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-remarkutil/RemarkUtil.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-remarkutil/RemarkUtil.cpp b/contrib/llvm-project/llvm/tools/llvm-remarkutil/RemarkUtil.cpp
new file mode 100644
index 000000000000..8ab3fbba4311
--- /dev/null
+++ b/contrib/llvm-project/llvm/tools/llvm-remarkutil/RemarkUtil.cpp
@@ -0,0 +1,41 @@
+//===--------- llvm-remarkutil/RemarkUtil.cpp -----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+/// Utility for remark files.
+//===----------------------------------------------------------------------===//
+
+#include "RemarkUtilRegistry.h"
+#include "llvm/Support/InitLLVM.h"
+
+using namespace llvm;
+using namespace llvm::remarkutil;
+ExitOnError ExitOnErr;
+
+static Error handleSubOptions() {
+ for (auto *SC : cl::getRegisteredSubcommands()) {
+ if (*SC) {
+ // If no subcommand was provided, we need to explicitly check if this is
+ // the top-level subcommand.
+ if (SC == &cl::SubCommand::getTopLevel())
+ break;
+ if (auto C = dispatch(SC)) {
+ return C();
+ }
+ }
+ }
+
+ return make_error<StringError>(
+ "Please specify a subcommand. (See -help for options)",
+ inconvertibleErrorCode());
+}
+
+int main(int argc, char *argv[]) {
+ InitLLVM X(argc, argv);
+ cl::ParseCommandLineOptions(argc, argv, "Remark file utilities\n");
+ ExitOnErr.setBanner(std::string(argv[0]) + ": error: ");
+ ExitOnErr(handleSubOptions());
+}