[lld] r277761 - [MachO] Factor out some common code in the Driver.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 15:52:08 PDT 2016
Nice clean-up. Thanks very much!
- Lang.
On Thu, Aug 4, 2016 at 12:56 PM, Davide Italiano via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: davide
> Date: Thu Aug 4 14:56:26 2016
> New Revision: 277761
>
> URL: http://llvm.org/viewvc/llvm-project?rev=277761&view=rev
> Log:
> [MachO] Factor out some common code in the Driver.
>
> Modified:
> lld/trunk/lib/Driver/DarwinLdDriver.cpp
>
> Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/
> DarwinLdDriver.cpp?rev=277761&r1=277760&r2=277761&view=diff
> ============================================================
> ==================
> --- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
> +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Thu Aug 4 14:56:26 2016
> @@ -1137,6 +1137,18 @@ bool parse(llvm::ArrayRef<const char *>
> return ctx.validate(diagnostics);
> }
>
> +static void createFiles(MachOLinkingContext &ctx, bool Implicit) {
> + std::vector<std::unique_ptr<File>> Files;
> + if (Implicit)
> + ctx.createImplicitFiles(Files);
> + else
> + ctx.createInternalFiles(Files);
> + for (auto i = Files.rbegin(), e = Files.rend(); i != e; ++i) {
> + auto &members = ctx.getNodes();
> + members.insert(members.begin(), llvm::make_unique<FileNode>(
> std::move(*i)));
> + }
> +}
> +
> /// This is where the link is actually performed.
> bool link(llvm::ArrayRef<const char *> args, raw_ostream &diagnostics) {
> MachOLinkingContext ctx;
> @@ -1151,20 +1163,10 @@ bool link(llvm::ArrayRef<const char *> a
> if (FileNode *node = dyn_cast<FileNode>(ie.get()))
> node->getFile()->parse();
>
> - std::vector<std::unique_ptr<File>> internalFiles;
> - ctx.createInternalFiles(internalFiles);
> - for (auto i = internalFiles.rbegin(), e = internalFiles.rend(); i != e;
> ++i) {
> - auto &members = ctx.getNodes();
> - members.insert(members.begin(), llvm::make_unique<FileNode>(
> std::move(*i)));
> - }
> + createFiles(ctx, false /* Implicit */);
>
> - // Give target a chance to add files.
> - std::vector<std::unique_ptr<File>> implicitFiles;
> - ctx.createImplicitFiles(implicitFiles);
> - for (auto i = implicitFiles.rbegin(), e = implicitFiles.rend(); i != e;
> ++i) {
> - auto &members = ctx.getNodes();
> - members.insert(members.begin(), llvm::make_unique<FileNode>(
> std::move(*i)));
> - }
> + // Give target a chance to add files
> + createFiles(ctx, true /* Implicit */);
>
> // Give target a chance to postprocess input files.
> // Mach-O uses this chance to move all object files before library
> files.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160808/866a2c0f/attachment.html>
More information about the llvm-commits
mailing list