<div dir="ltr"><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote"><div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">+</blockquote></div></div></div><div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">+ // Transfer ownership to "out" File parameter.</blockquote></div></div></div><div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">+ std::unique_ptr<lld::File> f = std::move(*fileOrError);</blockquote></div></div></div><div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">+ file = f.release();</blockquote></div></div></div></blockquote><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br><blockquote></blockquote>Aside, this ^ seems like an odd sequence. Are those two lines equivalent to:<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> file = fileOrError->release();</blockquote></div></div><div><br></div>Why yes. Yes they are. Fixed in r265566. I'll look at changing that out-parameter to a unique_ptr in a subsequent patch too.<div><div><br></div><div>- Lang.<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 6, 2016 at 8:29 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Apr 5, 2016 at 3:06 PM, Lang Hames via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: lhames<br>
Date: Tue Apr 5 17:06:48 2016<br>
New Revision: 265477<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=265477&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=265477&view=rev</a><br>
Log:<br>
[lld][MachO] Check Expected<T> for error prior to destruction.<br>
<br>
This should fix the failures on the LLD bots caused by r265446.<br>
<br>
<br>
Modified:<br>
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp?rev=265477&r1=265476&r2=265477&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp?rev=265477&r1=265476&r2=265477&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp Tue Apr 5 17:06:48 2016<br>
@@ -767,22 +767,9 @@ bool MachOYamlIOTaggedDocumentHandler::h<br>
MappingTraits<NormalizedFile>::mapping(io, nf);<br>
// Step 2: parse normalized mach-o struct into atoms.<br>
auto fileOrError = normalizedToAtoms(nf, info->_path, true);<br>
- if (nf.arch != _arch) {<br>
- io.setError(Twine("file is wrong architecture. Expected ("<br>
- + MachOLinkingContext::nameFromArch(_arch)<br>
- + ") found ("<br>
- + MachOLinkingContext::nameFromArch(nf.arch)<br>
- + ")"));<br>
- return false;<br>
- }<br>
- info->_normalizeMachOFile = nullptr;<br>
<br>
- if (fileOrError) {<br>
- // Transfer ownership to "out" File parameter.<br>
- std::unique_ptr<lld::File> f = std::move(fileOrError.get());<br>
- file = f.release();<br>
- return true;<br>
- } else {<br>
+ // Check that we parsed successfully.<br>
+ if (!fileOrError) {<br>
std::string buffer;<br>
llvm::raw_string_ostream stream(buffer);<br>
handleAllErrors(fileOrError.takeError(),<br>
@@ -793,6 +780,21 @@ bool MachOYamlIOTaggedDocumentHandler::h<br>
io.setError(stream.str());<br>
return false;<br>
}<br>
+<br>
+ if (nf.arch != _arch) {<br>
+ io.setError(Twine("file is wrong architecture. Expected ("<br>
+ + MachOLinkingContext::nameFromArch(_arch)<br>
+ + ") found ("<br>
+ + MachOLinkingContext::nameFromArch(nf.arch)<br>
+ + ")"));<br>
+ return false;<br>
+ }<br>
+ info->_normalizeMachOFile = nullptr;<br>
+<br>
+ // Transfer ownership to "out" File parameter.<br>
+ std::unique_ptr<lld::File> f = std::move(*fileOrError);<br>
+ file = f.release();<br></blockquote><div><br></div></div></div><div>Aside, this ^ seems like an odd sequence. Are those two lines equivalent to:<br><br> file = fileOrError->release();</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ return true;<br>
}<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div></div></div></div>