[PATCH] D20550: Linker: error_code'ify the IR mover. NFC.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 20:03:21 PDT 2016

lhames accepted this revision.
lhames added a reviewer: lhames.
lhames added a comment.
This revision is now accepted and ready to land.

Otherwise LGTM.

Comment at: lib/Linker/LinkModules.cpp:588
@@ +587,3 @@
+      HasErrors = true;
+      return Error::success();
+    });
Minor nitpick - You don't actually need to return Error::success() from handlers: the ErrorHandlerTraits will infer it if there's no return statement.

You could also put the call inline in the handleAllErrors call:

    Mover.move(std::move(SrcM), ValuesToLink.getArrayRef(),
               [this](GlobalValue &GV, IRMover::ValueAdder Add) {
                 addLazyFor(GV, Add);
    [&](ErrorInfoBase &EIB) {
      DstM.getContext().diagnose(LinkDiagnosticInfo(DS_Error, EIB.message()));
      HasErrors = true;

I haven't formed any strong feelings on Error style yet though. If you prefer to keep the existing style to show a clear separation between the call and the handlers that's fine by me. 

Comment at: tools/gold/gold-plugin.cpp:1156
@@ +1155,3 @@
+              EIB.message().c_str());
+      return Error::success();
+    });
Likewise here.


More information about the llvm-commits mailing list