| 1 |
//===- ObjcopyOptions.h ---------------------------------------------------===// |
| 2 |
// |
| 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 |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#ifndef LLVM_TOOLS_LLVM_OBJCOPY_OBJCOPYOPTIONS_H |
| 10 |
#define LLVM_TOOLS_LLVM_OBJCOPY_OBJCOPYOPTIONS_H |
| 11 |
|
| 12 |
#include "llvm/ObjCopy/ConfigManager.h" |
| 13 |
#include "llvm/Support/Allocator.h" |
| 14 |
|
| 15 |
namespace llvm { |
| 16 |
namespace objcopy { |
| 17 |
|
| 18 |
// Configuration for the overall invocation of this tool. When invoked as |
| 19 |
// objcopy, will always contain exactly one CopyConfig. When invoked as strip, |
| 20 |
// will contain one or more CopyConfigs. |
| 21 |
struct DriverConfig { |
| 22 |
SmallVector<ConfigManager, 1> CopyConfigs; |
| 23 |
BumpPtrAllocator Alloc; |
| 24 |
}; |
| 25 |
|
| 26 |
// ParseObjcopyOptions returns the config and sets the input arguments. If a |
| 27 |
// help flag is set then ParseObjcopyOptions will print the help messege and |
| 28 |
// exit. ErrorCallback is used to handle recoverable errors. An Error returned |
| 29 |
// by the callback aborts the parsing and is then returned by this function. |
| 30 |
Expected<DriverConfig> |
| 31 |
parseObjcopyOptions(ArrayRef<const char *> ArgsArr, |
| 32 |
llvm::function_ref<Error(Error)> ErrorCallback); |
| 33 |
|
| 34 |
// ParseInstallNameToolOptions returns the config and sets the input arguments. |
| 35 |
// If a help flag is set then ParseInstallNameToolOptions will print the help |
| 36 |
// messege and exit. |
| 37 |
Expected<DriverConfig> |
| 38 |
parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr); |
| 39 |
|
| 40 |
// ParseBitcodeStripOptions returns the config and sets the input arguments. |
| 41 |
// If a help flag is set then ParseBitcodeStripOptions will print the help |
| 42 |
// messege and exit. |
| 43 |
Expected<DriverConfig> |
| 44 |
parseBitcodeStripOptions(ArrayRef<const char *> ArgsArr, |
| 45 |
llvm::function_ref<Error(Error)> ErrorCallback); |
| 46 |
|
| 47 |
// ParseStripOptions returns the config and sets the input arguments. If a |
| 48 |
// help flag is set then ParseStripOptions will print the help messege and |
| 49 |
// exit. ErrorCallback is used to handle recoverable errors. An Error returned |
| 50 |
// by the callback aborts the parsing and is then returned by this function. |
| 51 |
Expected<DriverConfig> |
| 52 |
parseStripOptions(ArrayRef<const char *> ArgsArr, |
| 53 |
llvm::function_ref<Error(Error)> ErrorCallback); |
| 54 |
} // namespace objcopy |
| 55 |
} // namespace llvm |
| 56 |
|
| 57 |
#endif // LLVM_TOOLS_LLVM_OBJCOPY_OBJCOPYOPTIONS_H |