Path: blob/main/contrib/llvm-project/llvm/tools/llvm-remarkutil/RemarkUtilRegistry.h
35230 views
//===- RemarkUtilRegistry.h: Implement a command registry. ----------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Implement a simple subcommand registry.9//10//===----------------------------------------------------------------------===//11#ifndef TOOLS_LLVM_REMARKUTIL_REGISTRY_H12#define TOOLS_LLVM_REMARKUTIL_REGISTRY_H1314#include "llvm/Support/CommandLine.h"15#include "llvm/Support/Error.h"1617namespace llvm {18namespace remarkutil {1920// Use |CommandRegistration| as a global initialiser that registers a function21// and associates it with |SC|. This requires that a command has not been22// registered to a given |SC|.23//24// Usage:25//26// // At namespace scope.27// static CommandRegistration Unused(&MySubCommand, [] { ... });28//29struct CommandRegistration {30CommandRegistration(cl::SubCommand *SC, std::function<Error()> Command);31};3233// Requires that |SC| is not null and has an associated function to it.34std::function<Error()> dispatch(cl::SubCommand *SC);3536} // namespace remarkutil37} // namespace llvm3839#endif // TOOLS_LLVM_REMARKUTIL_REGISTRY_H404142