<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">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:0 0 0 .8ex;border-left:1px #ccc 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>Aside, this ^ seems like an odd sequence. Are those two lines equivalent to:<br><br> file = fileOrError->release();</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc 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">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></div><br></div></div>