xref: /freebsd-src/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOptions.h (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
1*81ad6265SDimitry Andric //===- ObjcopyOptions.h ---------------------------------------------------===//
2*81ad6265SDimitry Andric //
3*81ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*81ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*81ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*81ad6265SDimitry Andric //
7*81ad6265SDimitry Andric //===----------------------------------------------------------------------===//
8*81ad6265SDimitry Andric 
9*81ad6265SDimitry Andric #ifndef LLVM_TOOLS_LLVM_OBJCOPY_OBJCOPYOPTIONS_H
10*81ad6265SDimitry Andric #define LLVM_TOOLS_LLVM_OBJCOPY_OBJCOPYOPTIONS_H
11*81ad6265SDimitry Andric 
12*81ad6265SDimitry Andric #include "llvm/ObjCopy/ConfigManager.h"
13*81ad6265SDimitry Andric #include "llvm/Support/Allocator.h"
14*81ad6265SDimitry Andric #include <vector>
15*81ad6265SDimitry Andric 
16*81ad6265SDimitry Andric namespace llvm {
17*81ad6265SDimitry Andric namespace objcopy {
18*81ad6265SDimitry Andric 
19*81ad6265SDimitry Andric // Configuration for the overall invocation of this tool. When invoked as
20*81ad6265SDimitry Andric // objcopy, will always contain exactly one CopyConfig. When invoked as strip,
21*81ad6265SDimitry Andric // will contain one or more CopyConfigs.
22*81ad6265SDimitry Andric struct DriverConfig {
23*81ad6265SDimitry Andric   SmallVector<ConfigManager, 1> CopyConfigs;
24*81ad6265SDimitry Andric   BumpPtrAllocator Alloc;
25*81ad6265SDimitry Andric };
26*81ad6265SDimitry Andric 
27*81ad6265SDimitry Andric // ParseObjcopyOptions returns the config and sets the input arguments. If a
28*81ad6265SDimitry Andric // help flag is set then ParseObjcopyOptions will print the help messege and
29*81ad6265SDimitry Andric // exit. ErrorCallback is used to handle recoverable errors. An Error returned
30*81ad6265SDimitry Andric // by the callback aborts the parsing and is then returned by this function.
31*81ad6265SDimitry Andric Expected<DriverConfig>
32*81ad6265SDimitry Andric parseObjcopyOptions(ArrayRef<const char *> ArgsArr,
33*81ad6265SDimitry Andric                     llvm::function_ref<Error(Error)> ErrorCallback);
34*81ad6265SDimitry Andric 
35*81ad6265SDimitry Andric // ParseInstallNameToolOptions returns the config and sets the input arguments.
36*81ad6265SDimitry Andric // If a help flag is set then ParseInstallNameToolOptions will print the help
37*81ad6265SDimitry Andric // messege and exit.
38*81ad6265SDimitry Andric Expected<DriverConfig>
39*81ad6265SDimitry Andric parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr);
40*81ad6265SDimitry Andric 
41*81ad6265SDimitry Andric // ParseBitcodeStripOptions returns the config and sets the input arguments.
42*81ad6265SDimitry Andric // If a help flag is set then ParseBitcodeStripOptions will print the help
43*81ad6265SDimitry Andric // messege and exit.
44*81ad6265SDimitry Andric Expected<DriverConfig>
45*81ad6265SDimitry Andric parseBitcodeStripOptions(ArrayRef<const char *> ArgsArr,
46*81ad6265SDimitry Andric                          llvm::function_ref<Error(Error)> ErrorCallback);
47*81ad6265SDimitry Andric 
48*81ad6265SDimitry Andric // ParseStripOptions returns the config and sets the input arguments. If a
49*81ad6265SDimitry Andric // help flag is set then ParseStripOptions will print the help messege and
50*81ad6265SDimitry Andric // exit. ErrorCallback is used to handle recoverable errors. An Error returned
51*81ad6265SDimitry Andric // by the callback aborts the parsing and is then returned by this function.
52*81ad6265SDimitry Andric Expected<DriverConfig>
53*81ad6265SDimitry Andric parseStripOptions(ArrayRef<const char *> ArgsArr,
54*81ad6265SDimitry Andric                   llvm::function_ref<Error(Error)> ErrorCallback);
55*81ad6265SDimitry Andric } // namespace objcopy
56*81ad6265SDimitry Andric } // namespace llvm
57*81ad6265SDimitry Andric 
58*81ad6265SDimitry Andric #endif // LLVM_TOOLS_LLVM_OBJCOPY_OBJCOPYOPTIONS_H
59