[llvm] r267298 - BitcodeReader: Avoid non-moving std::piecewise_construct from r267296

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 10:37:46 PDT 2016


On Sat, Apr 23, 2016 at 2:23 PM, Duncan P. N. Exon Smith via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: dexonsmith
> Date: Sat Apr 23 16:23:41 2016
> New Revision: 267298
>
> URL: http://llvm.org/viewvc/llvm-project?rev=267298&view=rev
> Log:
> BitcodeReader: Avoid non-moving std::piecewise_construct from r267296
>
> Not exactly sure why the host tries to use a copy constructor here, but
> it's easy enough to work around it.
>
> http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11/builds/6227
>
> Modified:
>     llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
>
> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=267298&r1=267297&r2=267298&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sat Apr 23 16:23:41
> 2016
> @@ -1215,9 +1215,9 @@ Metadata *BitcodeReaderMetadataList::upg
>
>    // Create and return a placeholder to use for now.  Eventually
>    // resolveTypeRefArrays() will be resolve this forward reference.
> -  OldTypeRefs.Arrays.emplace_back(
> -      std::piecewise_construct, std::make_tuple(Tuple),
> -      std::make_tuple(MDTuple::getTemporary(Context, None)));
>

make_tuple copies the contents, like make_pair

Typically what you want to use with piecewise_construct is
std::forward_as_tuple instead. This creates a tuple of references (of the
right kind - rvalue or lvalue, etc). Try that?


> +  OldTypeRefs.Arrays.emplace_back();
> +  OldTypeRefs.Arrays.back().first.reset(Tuple);
> +  OldTypeRefs.Arrays.back().second = MDTuple::getTemporary(Context, None);
>    return OldTypeRefs.Arrays.back().second.get();
>  }
>
>
>
> _______________________________________________
> 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/20160425/80dd8d73/attachment.html>


More information about the llvm-commits mailing list