[llvm] r257840 - Orc: Simplify some things with NSDMIs and some braced init.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 18:09:15 PST 2016


Nice cleanup. Thanks Dave!

- Lang.

On Thu, Jan 14, 2016 at 3:33 PM, David Blaikie via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: dblaikie
> Date: Thu Jan 14 17:33:43 2016
> New Revision: 257840
>
> URL: http://llvm.org/viewvc/llvm-project?rev=257840&view=rev
> Log:
> Orc: Simplify some things with NSDMIs and some braced init.
>
> Modified:
>     llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
>     llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
>
> Modified:
> llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h?rev=257840&r1=257839&r2=257840&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
> (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
> Thu Jan 14 17:33:43 2016
> @@ -276,8 +276,7 @@ public:
>      class Alloc {
>      public:
>        Alloc(uint64_t Size, unsigned Align)
> -          : Size(Size), Align(Align), Contents(new char[Size + Align -
> 1]),
> -            RemoteAddr(0) {}
> +          : Size(Size), Align(Align), Contents(new char[Size + Align -
> 1]) {}
>
>        Alloc(Alloc &&Other)
>            : Size(std::move(Other.Size)), Align(std::move(Other.Align)),
> @@ -312,12 +311,11 @@ public:
>        uint64_t Size;
>        unsigned Align;
>        std::unique_ptr<char[]> Contents;
> -      TargetAddress RemoteAddr;
> +      TargetAddress RemoteAddr = 0;
>      };
>
>      struct ObjectAllocs {
> -      ObjectAllocs()
> -          : RemoteCodeAddr(0), RemoteRODataAddr(0), RemoteRWDataAddr(0) {}
> +      ObjectAllocs() = default;
>
>        ObjectAllocs(ObjectAllocs &&Other)
>            : RemoteCodeAddr(std::move(Other.RemoteCodeAddr)),
> @@ -337,9 +335,9 @@ public:
>          return *this;
>        }
>
> -      TargetAddress RemoteCodeAddr;
> -      TargetAddress RemoteRODataAddr;
> -      TargetAddress RemoteRWDataAddr;
> +      TargetAddress RemoteCodeAddr = 0;
> +      TargetAddress RemoteRODataAddr = 0;
> +      TargetAddress RemoteRWDataAddr = 0;
>        std::vector<Alloc> CodeAllocs, RODataAllocs, RWDataAllocs;
>      };
>
> @@ -410,9 +408,6 @@ public:
>
>    private:
>      struct RemoteIndirectStubsInfo {
> -      RemoteIndirectStubsInfo(TargetAddress StubBase, TargetAddress
> PtrBase,
> -                              unsigned NumStubs)
> -          : StubBase(StubBase), PtrBase(PtrBase), NumStubs(NumStubs) {}
>        TargetAddress StubBase;
>        TargetAddress PtrBase;
>        unsigned NumStubs;
> @@ -438,8 +433,7 @@ public:
>                                 NewStubsRequired);
>
>        unsigned NewBlockId = RemoteIndirectStubsInfos.size();
> -      RemoteIndirectStubsInfos.push_back(
> -          RemoteIndirectStubsInfo(StubBase, PtrBase, NumStubsEmitted));
> +      RemoteIndirectStubsInfos.push_back({StubBase, PtrBase,
> NumStubsEmitted});
>
>        for (unsigned I = 0; I < NumStubsEmitted; ++I)
>          FreeStubs.push_back(std::make_pair(NewBlockId, I));
> @@ -627,8 +621,7 @@ public:
>
>  private:
>    OrcRemoteTargetClient(ChannelT &Channel, std::error_code &EC)
> -      : Channel(Channel), RemotePointerSize(0), RemotePageSize(0),
> -        RemoteTrampolineSize(0), RemoteIndirectStubSize(0) {
> +      : Channel(Channel) {
>      if ((EC = call<GetRemoteInfo>(Channel)))
>        return;
>
> @@ -790,10 +783,10 @@ private:
>    ChannelT &Channel;
>    std::error_code ExistingError;
>    std::string RemoteTargetTriple;
> -  uint32_t RemotePointerSize;
> -  uint32_t RemotePageSize;
> -  uint32_t RemoteTrampolineSize;
> -  uint32_t RemoteIndirectStubSize;
> +  uint32_t RemotePointerSize = 0;
> +  uint32_t RemotePageSize = 0;
> +  uint32_t RemoteTrampolineSize = 0;
> +  uint32_t RemoteIndirectStubSize = 0;
>    ResourceIdMgr AllocatorIds, IndirectStubOwnerIds;
>    std::function<TargetAddress(TargetAddress)> CompileCallback;
>  };
>
> Modified:
> llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h?rev=257840&r1=257839&r2=257840&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
> (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
> Thu Jan 14 17:33:43 2016
> @@ -29,7 +29,6 @@ protected:
>    class ResourceIdMgr {
>    public:
>      typedef uint64_t ResourceId;
> -    ResourceIdMgr() : NextId(0) {}
>      ResourceId getNext() {
>        if (!FreeIds.empty()) {
>          ResourceId I = FreeIds.back();
> @@ -41,7 +40,7 @@ protected:
>      void release(ResourceId I) { FreeIds.push_back(I); }
>
>    private:
> -    ResourceId NextId;
> +    ResourceId NextId = 0;
>      std::vector<ResourceId> FreeIds;
>    };
>
>
>
> _______________________________________________
> 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/20160115/91086fc2/attachment.html>


More information about the llvm-commits mailing list