<p dir="ltr"><br>
On Mar 9, 2014 6:41 PM, "Chandler Carruth" <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br>
><br>
> Author: chandlerc<br>
> Date: Sun Mar 9 20:32:25 2014<br>
> New Revision: 203431<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=203431&view=rev">http://llvm.org/viewvc/llvm-project?rev=203431&view=rev</a><br>
> Log:<br>
> [PM] As Dave noticed in review, I had erroneously copied the move<br>
> constructors from the classes which only have a single reference member<br>
> to many other places.</p>
<p dir="ltr">Is they any reason this type even had a move constrictor if it wasn't actually doing any move work? Might be good to remove it so it doesn't erroneously indoor anyone else to make the same mistake.</p>
<p dir="ltr">> This resulted in them copying their single member<br>
> instead of moving. =/ Fix this.<br>
><br>
> There's really not a useful test to add sadly because these move<br>
> constructors are only called when something deep inside some standard<br>
> library implementation *needs* to move them. Many of the types aren't<br>
> even user-impacting types. Or, the objects are copyable anyways and so<br>
> the result was merely a performance problem rather than a correctness<br>
> problem.<br>
><br>
> Anyways, thanks for the review. And this is a great example of why<br>
> I wish I colud have the compiler write these for me.<br>
><br>
> Modified:<br>
> llvm/trunk/include/llvm/IR/PassManager.h<br>
><br>
> Modified: llvm/trunk/include/llvm/IR/PassManager.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=203431&r1=203430&r2=203431&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=203431&r1=203430&r2=203431&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/IR/PassManager.h (original)<br>
> +++ llvm/trunk/include/llvm/IR/PassManager.h Sun Mar 9 20:32:25 2014<br>
> @@ -70,7 +70,7 @@ public:<br>
> PreservedAnalyses(const PreservedAnalyses &Arg)<br>
> : PreservedPassIDs(Arg.PreservedPassIDs) {}<br>
> PreservedAnalyses(PreservedAnalyses &&Arg)<br>
> - : PreservedPassIDs(Arg.PreservedPassIDs) {}<br>
> + : PreservedPassIDs(std::move(Arg.PreservedPassIDs)) {}<br>
> PreservedAnalyses &operator=(PreservedAnalyses RHS) {<br>
> std::swap(*this, RHS);<br>
> return *this;<br>
> @@ -207,7 +207,7 @@ struct PassModel<IRUnitT, AnalysisManage<br>
> // We have to explicitly define all the special member functions because MSVC<br>
> // refuses to generate them.<br>
> PassModel(const PassModel &Arg) : Pass(Arg.Pass) {}<br>
> - PassModel(PassModel &&Arg) : Pass(Arg.Pass) {}<br>
> + PassModel(PassModel &&Arg) : Pass(std::move(Arg.Pass)) {}<br>
> PassModel &operator=(PassModel RHS) {<br>
> std::swap(*this, RHS);<br>
> return *this;<br>
> @@ -229,7 +229,7 @@ struct PassModel<IRUnitT, AnalysisManage<br>
> // We have to explicitly define all the special member functions because MSVC<br>
> // refuses to generate them.<br>
> PassModel(const PassModel &Arg) : Pass(Arg.Pass) {}<br>
> - PassModel(PassModel &&Arg) : Pass(Arg.Pass) {}<br>
> + PassModel(PassModel &&Arg) : Pass(std::move(Arg.Pass)) {}<br>
> PassModel &operator=(PassModel RHS) {<br>
> std::swap(*this, RHS);<br>
> return *this;<br>
> @@ -298,7 +298,8 @@ struct AnalysisResultModel<IRUnitT, Pass<br>
> // We have to explicitly define all the special member functions because MSVC<br>
> // refuses to generate them.<br>
> AnalysisResultModel(const AnalysisResultModel &Arg) : Result(Arg.Result) {}<br>
> - AnalysisResultModel(AnalysisResultModel &&Arg) : Result(Arg.Result) {}<br>
> + AnalysisResultModel(AnalysisResultModel &&Arg)<br>
> + : Result(std::move(Arg.Result)) {}<br>
> AnalysisResultModel &operator=(AnalysisResultModel RHS) {<br>
> std::swap(*this, RHS);<br>
> return *this;<br>
> @@ -325,7 +326,8 @@ struct AnalysisResultModel<IRUnitT, Pass<br>
> // We have to explicitly define all the special member functions because MSVC<br>
> // refuses to generate them.<br>
> AnalysisResultModel(const AnalysisResultModel &Arg) : Result(Arg.Result) {}<br>
> - AnalysisResultModel(AnalysisResultModel &&Arg) : Result(Arg.Result) {}<br>
> + AnalysisResultModel(AnalysisResultModel &&Arg)<br>
> + : Result(std::move(Arg.Result)) {}<br>
> AnalysisResultModel &operator=(AnalysisResultModel RHS) {<br>
> std::swap(*this, RHS);<br>
> return *this;<br>
> @@ -374,7 +376,7 @@ struct AnalysisPassModel<IRUnitT, Analys<br>
> // We have to explicitly define all the special member functions because MSVC<br>
> // refuses to generate them.<br>
> AnalysisPassModel(const AnalysisPassModel &Arg) : Pass(Arg.Pass) {}<br>
> - AnalysisPassModel(AnalysisPassModel &&Arg) : Pass(Arg.Pass) {}<br>
> + AnalysisPassModel(AnalysisPassModel &&Arg) : Pass(std::move(Arg.Pass)) {}<br>
> AnalysisPassModel &operator=(AnalysisPassModel RHS) {<br>
> std::swap(*this, RHS);<br>
> return *this;<br>
> @@ -405,7 +407,7 @@ struct AnalysisPassModel<IRUnitT, Analys<br>
> // We have to explicitly define all the special member functions because MSVC<br>
> // refuses to generate them.<br>
> AnalysisPassModel(const AnalysisPassModel &Arg) : Pass(Arg.Pass) {}<br>
> - AnalysisPassModel(AnalysisPassModel &&Arg) : Pass(Arg.Pass) {}<br>
> + AnalysisPassModel(AnalysisPassModel &&Arg) : Pass(std::move(Arg.Pass)) {}<br>
> AnalysisPassModel &operator=(AnalysisPassModel RHS) {<br>
> std::swap(*this, RHS);<br>
> return *this;<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</p>