ObjcopyOptions.h 2.4 KB

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