[llvm] r250722 - [Orc] Add explicit move constructor and assignment operator to make MSVC happy.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 13:36:25 PDT 2015


On Mon, Oct 19, 2015 at 11:59 AM, Lang Hames via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: lhames
> Date: Mon Oct 19 13:59:22 2015
> New Revision: 250722
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250722&view=rev
> Log:
> [Orc] Add explicit move constructor and assignment operator to make MSVC
> happy.
>
> Modified:
>     llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
>
> Modified:
> llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=250722&r1=250721&r2=250722&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
> (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Mon
> Oct 19 13:59:22 2015
> @@ -22,6 +22,7 @@
>  #include "llvm/ExecutionEngine/SectionMemoryManager.h"
>  #include "llvm/Transforms/Utils/Cloning.h"
>  #include <list>
> +#include <memory>
>  #include <set>
>
>  #include "llvm/Support/Debug.h"
> @@ -66,6 +67,23 @@ private:
>      std::set<const Function*> StubsToClone;
>      std::unique_ptr<IndirectStubsMgrT> StubsMgr;
>
> +    LogicalModuleResources() {}
>

I'd prefer "= default" here (I think MSVC supports = default on
default/copy/dtor, just doesn't know how to generate implicit move ops).
Not sure it makes any real difference, though.


> +
> +    LogicalModuleResources(LogicalModuleResources &&Other) {
> +      SourceModule = std::move(Other.SourceModule);
> +      StubsToClone = std::move(StubsToClone);
> +      StubsMgr = std::move(StubsMgr);
>

Prefer the move ctors rather than default construct+move assign?

LogicalModuleResources(LogicalModuleResoruces&& Other) :
SourceModule(std::move(Other.SourceModule)), ...


> +    }
> +
> +    // Explicit move constructor to make MSVC happy.
>

Comment seems out of place ^


> +    LogicalModuleResources& operator=(LogicalModuleResources &&Other) {
> +      SourceModule = std::move(Other.SourceModule);
> +      StubsToClone = std::move(StubsToClone);
> +      StubsMgr = std::move(StubsMgr);
> +      return *this;
> +    }
> +
> +    // Explicit move assignment to make MSVC happy.
>

this one too ^


>      JITSymbol findSymbol(StringRef Name, bool ExportedSymbolsOnly) {
>        if (Name.endswith("$stub_ptr") && !ExportedSymbolsOnly) {
>          assert(!ExportedSymbolsOnly && "Stubs are never exported");
>
>
> _______________________________________________
> 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/20151019/650f802b/attachment.html>


More information about the llvm-commits mailing list