<div dir="ltr">Also might be marginally tidier if Paths was a unique_ptr, then you wouldn't have to explicitly null it out.<br><br>I think this is still a pretty subtle thing to allow move or copy support for & perhaps best avoided, or split into the query parameters and the result if we're going to support it.<br><br>For example - what happens to the original object under move assignment if Diagnose is true? Presumably we should diagnose rather than silently suppress, but that seems like a pretty surprising side effect of move assigning into an object. (perhaps no more than the result of moving into a unique_ptr that is non-null and having its object's dtor run)</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 18, 2016 at 6:31 AM, Benjamin Kramer via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: d0k<br>
Date: Fri Mar 18 08:31:00 2016<br>
New Revision: 263785<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=263785&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=263785&view=rev</a><br>
Log:<br>
Make LookupResult movable again.<br>
<br>
We lost copy semantics in r263730, because it only worked for a few very<br>
specific cases. Move semantics don't have this issue. Sadly the<br>
implementation is a bit messy but I don't know how to clean it up<br>
without losing support for msvc 2013 :/<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Sema/Lookup.h<br>
<br>
Modified: cfe/trunk/include/clang/Sema/Lookup.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=263785&r1=263784&r2=263785&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=263785&r1=263784&r2=263785&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Sema/Lookup.h (original)<br>
+++ cfe/trunk/include/clang/Sema/Lookup.h Fri Mar 18 08:31:00 2016<br>
@@ -190,6 +190,44 @@ public:<br>
   LookupResult(const LookupResult &) = delete;<br>
   LookupResult &operator=(const LookupResult &) = delete;<br>
<br>
+  LookupResult(LookupResult &&Other)<br>
+      : ResultKind(std::move(Other.ResultKind)),<br>
+        Ambiguity(std::move(Other.Ambiguity)), Decls(std::move(Other.Decls)),<br>
+        Paths(std::move(Other.Paths)),<br>
+        NamingClass(std::move(Other.NamingClass)),<br>
+        BaseObjectType(std::move(Other.BaseObjectType)),<br>
+        SemaPtr(std::move(Other.SemaPtr)), NameInfo(std::move(Other.NameInfo)),<br>
+        NameContextRange(std::move(Other.NameContextRange)),<br>
+        LookupKind(std::move(Other.LookupKind)), IDNS(std::move(Other.IDNS)),<br>
+        Redecl(std::move(Other.Redecl)), HideTags(std::move(Other.HideTags)),<br>
+        Diagnose(std::move(Other.Diagnose)),<br>
+        AllowHidden(std::move(Other.AllowHidden)),<br>
+        Shadowed(std::move(Other.Shadowed)) {<br>
+    Other.Paths = nullptr;<br>
+    Other.Diagnose = false;<br>
+  }<br>
+  LookupResult &operator=(LookupResult &&Other) {<br>
+    ResultKind = std::move(Other.ResultKind);<br>
+    Ambiguity = std::move(Other.Ambiguity);<br>
+    Decls = std::move(Other.Decls);<br>
+    Paths = std::move(Other.Paths);<br>
+    NamingClass = std::move(Other.NamingClass);<br>
+    BaseObjectType = std::move(Other.BaseObjectType);<br>
+    SemaPtr = std::move(Other.SemaPtr);<br>
+    NameInfo = std::move(Other.NameInfo);<br>
+    NameContextRange = std::move(Other.NameContextRange);<br>
+    LookupKind = std::move(Other.LookupKind);<br>
+    IDNS = std::move(Other.IDNS);<br>
+    Redecl = std::move(Other.Redecl);<br>
+    HideTags = std::move(Other.HideTags);<br>
+    Diagnose = std::move(Other.Diagnose);<br>
+    AllowHidden = std::move(Other.AllowHidden);<br>
+    Shadowed = std::move(Other.Shadowed);<br>
+    Other.Paths = nullptr;<br>
+    Other.Diagnose = false;<br>
+    return *this;<br>
+  }<br>
+<br>
   ~LookupResult() {<br>
     if (Diagnose) diagnose();<br>
     if (Paths) deletePaths(Paths);<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>