[PATCH] D100019: [lld-macho][nfc] Minor refactoring + clang-tidy fixes
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 7 10:58:37 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
oontvoo marked an inline comment as done.
Closed by commit rGffc65824f0ee: [lld-macho][nfc] Minor refactoring + clang-tidy fixes (authored by oontvoo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100019/new/
https://reviews.llvm.org/D100019
Files:
lld/MachO/Driver.cpp
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -1022,13 +1022,13 @@
if (args.hasArg(OPT_v)) {
message(getLLDVersion());
message(StringRef("Library search paths:") +
- (config->librarySearchPaths.size()
- ? "\n\t" + join(config->librarySearchPaths, "\n\t")
- : ""));
+ (config->librarySearchPaths.empty()
+ ? ""
+ : "\n\t" + join(config->librarySearchPaths, "\n\t")));
message(StringRef("Framework search paths:") +
- (config->frameworkSearchPaths.size()
- ? "\n\t" + join(config->frameworkSearchPaths, "\n\t")
- : ""));
+ (config->frameworkSearchPaths.empty()
+ ? ""
+ : "\n\t" + join(config->frameworkSearchPaths, "\n\t")));
}
config->progName = argsArr[0];
@@ -1052,17 +1052,22 @@
// Now that all dylibs have been loaded, search for those that should be
// re-exported.
- for (const Arg *arg : args.filtered(OPT_sub_library, OPT_sub_umbrella)) {
- config->hasReexports = true;
- StringRef searchName = arg->getValue();
- std::vector<StringRef> extensions;
- if (arg->getOption().getID() == OPT_sub_library)
- extensions = {".dylib", ".tbd"};
- else
- extensions = {".tbd"};
- if (!markReexport(searchName, extensions))
- error(arg->getSpelling() + " " + searchName +
- " does not match a supplied dylib");
+ {
+ auto reexportHandler = [](const Arg *arg,
+ const std::vector<StringRef> &extensions) {
+ config->hasReexports = true;
+ StringRef searchName = arg->getValue();
+ if (!markReexport(searchName, extensions))
+ error(arg->getSpelling() + " " + searchName +
+ " does not match a supplied dylib");
+ };
+ std::vector<StringRef> extensions = {".tbd"};
+ for (const Arg *arg : args.filtered(OPT_sub_umbrella))
+ reexportHandler(arg, extensions);
+
+ extensions.push_back(".dylib");
+ for (const Arg *arg : args.filtered(OPT_sub_library))
+ reexportHandler(arg, extensions);
}
// Parse LTO options.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100019.335871.patch
Type: text/x-patch
Size: 2319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/324c0b83/attachment.bin>
More information about the llvm-commits
mailing list