On Fri, Mar 18, 2016 at 6:31 AM, Benjamin Kramer via cfe-commits < cfe-commits@lists.llvm.org> wrote:
> Author: d0k > Date: Fri Mar 18 08:31:00 2016 > New Revision: 263785 > > URL: http://llvm.org/viewvc/llvm-project?rev=263785&view=rev > Log: > Make LookupResult movable again. > This shouldn't've been movable at all due to the presence of a user-declared dtor, right? Any code that was trying to move was really getting a broken copy, I think. > > We lost copy semantics in r263730, because it only worked for a few very > specific cases. Move semantics don't have this issue. Sadly the > implementation is a bit messy but I don't know how to clean it up > without losing support for msvc 2013 :/ > Modified: > cfe/trunk/include/clang/Sema/Lookup.h > > Modified: cfe/trunk/include/clang/Sema/Lookup.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=263785&r1=263784&r2=263785&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/Sema/Lookup.h (original) > +++ cfe/trunk/include/clang/Sema/Lookup.h Fri Mar 18 08:31:00 2016 > @@ -190,6 +190,44 @@ public: > LookupResult(const LookupResult &) = delete; > LookupResult &operator=(const LookupResult &) = delete; > > + LookupResult(LookupResult &&Other) > + : ResultKind(std::move(Other.ResultKind)), > + Ambiguity(std::move(Other.Ambiguity)), > Decls(std::move(Other.Decls)), > + Paths(std::move(Other.Paths)), > + NamingClass(std::move(Other.NamingClass)), > + BaseObjectType(std::move(Other.BaseObjectType)), > + SemaPtr(std::move(Other.SemaPtr)), > NameInfo(std::move(Other.NameInfo)), > + NameContextRange(std::move(Other.NameContextRange)), > + LookupKind(std::move(Other.LookupKind)), > IDNS(std::move(Other.IDNS)), > + Redecl(std::move(Other.Redecl)), > HideTags(std::move(Other.HideTags)), > + Diagnose(std::move(Other.Diagnose)), > + AllowHidden(std::move(Other.AllowHidden)), > + Shadowed(std::move(Other.Shadowed)) { > + Other.Paths = nullptr; > + Other.Diagnose = false; > + } > + LookupResult &operator=(LookupResult &&Other) { > + ResultKind = std::move(Other.ResultKind); > + Ambiguity = std::move(Other.Ambiguity); > + Decls = std::move(Other.Decls); > + Paths = std::move(Other.Paths); > + NamingClass = std::move(Other.NamingClass); > + BaseObjectType = std::move(Other.BaseObjectType); > + SemaPtr = std::move(Other.SemaPtr); > + NameInfo = std::move(Other.NameInfo); > + NameContextRange = std::move(Other.NameContextRange); > + LookupKind = std::move(Other.LookupKind); > + IDNS = std::move(Other.IDNS); > + Redecl = std::move(Other.Redecl); > + HideTags = std::move(Other.HideTags); > + Diagnose = std::move(Other.Diagnose); > + AllowHidden = std::move(Other.AllowHidden); > + Shadowed = std::move(Other.Shadowed); > + Other.Paths = nullptr; > + Other.Diagnose = false; > + return *this; > + } > + > ~LookupResult() { > if (Diagnose) diagnose(); > if (Paths) deletePaths(Paths); > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits