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