diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -55,9 +55,9 @@ Configuration *lld::macho::config; -static HeaderFileType getOutputType(const opt::InputArgList &args) { +static HeaderFileType getOutputType(const InputArgList &args) { // TODO: -r, -dylinker, -preload... - opt::Arg *outputArg = args.getLastArg(OPT_bundle, OPT_dylib, OPT_execute); + Arg *outputArg = args.getLastArg(OPT_bundle, OPT_dylib, OPT_execute); if (outputArg == nullptr) return MH_EXECUTE; @@ -137,7 +137,7 @@ } static std::vector -getSearchPaths(unsigned optionCode, opt::InputArgList &args, +getSearchPaths(unsigned optionCode, InputArgList &args, const std::vector &roots, const SmallVector &systemPaths) { std::vector paths; @@ -175,7 +175,7 @@ return paths; } -static std::vector getSystemLibraryRoots(opt::InputArgList &args) { +static std::vector getSystemLibraryRoots(InputArgList &args) { std::vector roots; for (const Arg *arg : args.filtered(OPT_syslibroot)) roots.push_back(arg->getValue()); @@ -190,13 +190,12 @@ } static std::vector -getLibrarySearchPaths(opt::InputArgList &args, - const std::vector &roots) { +getLibrarySearchPaths(InputArgList &args, const std::vector &roots) { return getSearchPaths(OPT_L, args, roots, {"/usr/lib", "/usr/local/lib"}); } static std::vector -getFrameworkSearchPaths(opt::InputArgList &args, +getFrameworkSearchPaths(InputArgList &args, const std::vector &roots) { return getSearchPaths(OPT_F, args, roots, {"/Library/Frameworks", "/System/Library/Frameworks"}); @@ -365,7 +364,7 @@ MachOOptTable table; unsigned missingIndex, missingCount; - opt::InputArgList args = table.ParseArgs(argv, missingIndex, missingCount); + InputArgList args = table.ParseArgs(argv, missingIndex, missingCount); if (missingCount) fatal(Twine(args.getArgString(missingIndex)) + ": missing argument"); for (const Arg *arg : args.filtered(OPT_UNKNOWN)) @@ -544,8 +543,8 @@ } // Has the side-effect of setting Config::platformInfo. -static PlatformKind parsePlatformVersion(const opt::ArgList &args) { - const opt::Arg *arg = args.getLastArg(OPT_platform_version); +static PlatformKind parsePlatformVersion(const ArgList &args) { + const Arg *arg = args.getLastArg(OPT_platform_version); if (!arg) { error("must specify -platform_version"); return PlatformKind::unknown; @@ -583,7 +582,7 @@ } // Has the side-effect of setting Config::target. -static TargetInfo *createTargetInfo(opt::InputArgList &args) { +static TargetInfo *createTargetInfo(InputArgList &args) { StringRef archName = args.getLastArgValue(OPT_arch); if (archName.empty()) fatal("must specify -arch"); @@ -603,7 +602,7 @@ } static UndefinedSymbolTreatment -getUndefinedSymbolTreatment(const opt::ArgList &args) { +getUndefinedSymbolTreatment(const ArgList &args) { StringRef treatmentStr = args.getLastArgValue(OPT_undefined); auto treatment = StringSwitch(treatmentStr) @@ -628,7 +627,7 @@ return treatment; } -static void warnIfDeprecatedOption(const opt::Option &opt) { +static void warnIfDeprecatedOption(const Option &opt) { if (!opt.getGroup().isValid()) return; if (opt.getGroup().getID() == OPT_grp_deprecated) { @@ -637,7 +636,7 @@ } } -static void warnIfUnimplementedOption(const opt::Option &opt) { +static void warnIfUnimplementedOption(const Option &opt) { if (!opt.getGroup().isValid() || !opt.hasFlag(DriverFlag::HelpHidden)) return; switch (opt.getGroup().getID()) { @@ -662,13 +661,13 @@ } } -static const char *getReproduceOption(opt::InputArgList &args) { +static const char *getReproduceOption(InputArgList &args) { if (const Arg *arg = args.getLastArg(OPT_reproduce)) return arg->getValue(); return getenv("LLD_REPRODUCE"); } -static bool isPie(opt::InputArgList &args) { +static bool isPie(InputArgList &args) { if (config->outputType != MH_EXECUTE || args.hasArg(OPT_no_pie)) return false; if (config->target.Arch == AK_arm64 || config->target.Arch == AK_arm64e) @@ -700,8 +699,8 @@ error(msg + ": " + StringRef(err).trim()); } -static uint32_t parseDylibVersion(const opt::ArgList& args, unsigned id) { - const opt::Arg *arg = args.getLastArg(id); +static uint32_t parseDylibVersion(const ArgList &args, unsigned id) { + const Arg *arg = args.getLastArg(id); if (!arg) return 0; @@ -748,7 +747,7 @@ return matchLiteral(symbolName) || matchGlob(symbolName); } -static void handleSymbolPatterns(opt::InputArgList &args, +static void handleSymbolPatterns(InputArgList &args, SymbolPatterns &symbolPatterns, unsigned singleOptionCode, unsigned listFileOptionCode) { @@ -783,7 +782,7 @@ MachOOptTable parser; - opt::InputArgList args = parser.parse(argsArr.slice(1)); + InputArgList args = parser.parse(argsArr.slice(1)); if (args.hasArg(OPT_help_hidden)) { parser.printHelp(argsArr[0], /*showHidden=*/true); @@ -836,7 +835,7 @@ config->printEachFile = args.hasArg(OPT_t); config->printWhyLoad = args.hasArg(OPT_why_load); config->outputType = getOutputType(args); - if (const opt::Arg *arg = args.getLastArg(OPT_bundle_loader)) { + if (const Arg *arg = args.getLastArg(OPT_bundle_loader)) { if (config->outputType != MH_BUNDLE) error("-bundle_loader can only be used with MachO bundle output"); addFile(arg->getValue(), false, true); @@ -851,10 +850,10 @@ config->demangle = args.hasArg(OPT_demangle); config->implicitDylibs = !args.hasArg(OPT_no_implicit_dylibs); - if (const opt::Arg *arg = args.getLastArg(OPT_static, OPT_dynamic)) + if (const Arg *arg = args.getLastArg(OPT_static, OPT_dynamic)) config->staticLink = (arg->getOption().getID() == OPT_static); - if (const opt::Arg *arg = + if (const Arg *arg = args.getLastArg(OPT_flat_namespace, OPT_twolevel_namespace)) config->namespaceKind = arg->getOption().getID() == OPT_twolevel_namespace ? NamespaceKind::twolevel @@ -867,7 +866,7 @@ getLibrarySearchPaths(args, config->systemLibraryRoots); config->frameworkSearchPaths = getFrameworkSearchPaths(args, config->systemLibraryRoots); - if (const opt::Arg *arg = + if (const Arg *arg = args.getLastArg(OPT_search_paths_first, OPT_search_dylibs_first)) config->searchDylibsFirst = arg->getOption().getID() == OPT_search_dylibs_first; diff --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp --- a/lld/MachO/DriverUtils.cpp +++ b/lld/MachO/DriverUtils.cpp @@ -39,9 +39,9 @@ #undef PREFIX // Create table mapping all options defined in Options.td -static const opt::OptTable::Info optInfo[] = { +static const OptTable::Info optInfo[] = { #define OPTION(X1, X2, ID, KIND, GROUP, ALIAS, X7, X8, X9, X10, X11, X12) \ - {X1, X2, X10, X11, OPT_##ID, opt::Option::KIND##Class, \ + {X1, X2, X10, X11, OPT_##ID, Option::KIND##Class, \ X9, X8, OPT_##GROUP, OPT_##ALIAS, X7, X12}, #include "Options.inc" #undef OPTION @@ -51,7 +51,7 @@ // Set color diagnostics according to --color-diagnostics={auto,always,never} // or --no-color-diagnostics flags. -static void handleColorDiagnostics(opt::InputArgList &args) { +static void handleColorDiagnostics(InputArgList &args) { const Arg *arg = args.getLastArg(OPT_color_diagnostics, OPT_color_diagnostics_eq, OPT_no_color_diagnostics); @@ -72,7 +72,7 @@ } } -opt::InputArgList MachOOptTable::parse(ArrayRef argv) { +InputArgList MachOOptTable::parse(ArrayRef argv) { // Make InputArgList from string vectors. unsigned missingIndex; unsigned missingCount; @@ -81,7 +81,7 @@ // Expand response files (arguments in the form of @) // and then parse the argument again. cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec); - opt::InputArgList args = ParseArgs(vec, missingIndex, missingCount); + InputArgList args = ParseArgs(vec, missingIndex, missingCount); // Handle -fatal_warnings early since it converts missing argument warnings // to errors. @@ -92,7 +92,7 @@ handleColorDiagnostics(args); - for (opt::Arg *arg : args.filtered(OPT_UNKNOWN)) { + for (const Arg *arg : args.filtered(OPT_UNKNOWN)) { std::string nearest; if (findNearest(arg->getAsString(args), nearest) > 1) error("unknown argument '" + arg->getAsString(args) + "'"); @@ -117,7 +117,7 @@ // Reconstructs command line arguments so that so that you can re-run // the same command with the same inputs. This is for --reproduce. -std::string macho::createResponseFile(const opt::InputArgList &args) { +std::string macho::createResponseFile(const InputArgList &args) { SmallString<0> data; raw_svector_ostream os(data);