[lld] r264077 - More MSVC bot appeasement. Explicitly define rvalue methods on SortKey.

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 11:21:12 PDT 2016


> On Mar 22, 2016, at 11:18 AM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Tue, Mar 22, 2016 at 11:09 AM, Pete Cooper via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: pete
> Date: Tue Mar 22 13:09:55 2016
> New Revision: 264077
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=264077&view=rev <http://llvm.org/viewvc/llvm-project?rev=264077&view=rev>
> Log:
> More MSVC bot appeasement.  Explicitly define rvalue methods on SortKey.
> 
> OwningAtomPtr does not have OwningAtomPtr(OwningAtomPtr&) or the equivalent
> operator= as we only want to use rvalue references in it.
> 
> SortKey didn't like this on MSVC as it was synthesizing SortKey(SortKey&) and
> trying to use the OwningAtomPtr(OwningAtomPtr&) method which was private an
> unimplemented.
> 
> Now we explicitly have the methods on SortKey so hopefully the bot will be
> happier.
> 
> Modified:
>     lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h
> 
> Modified: lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h?rev=264077&r1=264076&r2=264077&view=diff <http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h?rev=264077&r1=264076&r2=264077&view=diff>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h (original)
> +++ lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h Tue Mar 22 13:09:55 2016
> @@ -39,6 +39,25 @@ public:
>      OwningAtomPtr<DefinedAtom> _atom;
>      const DefinedAtom *_root;
>      uint64_t _override;
> +
> +    // Note, these are only here to appease MSVC bots which didn't like
> +    // the same methods being implemented/deleted in OwningAtomPtr.
> +    SortKey(SortKey &&key) : _atom(std::move(key._atom)), _root(key._root),
> +                             _override(key._override) {
> +      key._root = nullptr;
> 
> Why do you need to null that out? (it doesn't look like this type has a fancy dtor that's going to try to delete _root or do anything weird with it?) Same question in the assignment operator
I don’t have a good answer :)

To be honest, I just figured that nulling out pointers was good practice, but I’m not basing that on anything other than my own thinking.  

I'll give the bots a chance to run on this as is (i’ve broken them numerous times already), and assuming I don’t have to back out this whole series of patches I’ll fix this up when they are happy.

Thanks
Pete
>  
> +    }
> +
> +    SortKey &operator=(SortKey &&key) {
> +      _atom = std::move(key._atom);
> +      _root = key._root;
> +      key._root = nullptr;
> +      _override = key._override;
> +      return *this;
> +    }
> +
> +  private:
> +    SortKey(const SortKey &) = delete;
> +    void operator=(const SortKey&) = delete;
>    };
> 
>    typedef std::function<bool (const DefinedAtom *left, const DefinedAtom *right,
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <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/20160322/d32cc289/attachment.html>


More information about the llvm-commits mailing list