<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Dec 13, 2014 at 5:25 AM, <a href="mailto:kledzik@apple.com">kledzik@apple.com</a> <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The method Reader::parseFile() no longer has an appropriate name (since it no longer parses).  It now just constructs a File object.<br></blockquote><div><br></div><div>I will rename that later when everything is done.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
================<br>
Comment at: include/lld/Core/File.h:157-171<br>
@@ -155,1 +156,17 @@<br>
<br>
+  /// \brief Subclasses should override this method to parse the<br>
<span class="">+  /// memory buffer passed to this file's constructor.<br>
+  virtual std::error_code doParse() { return std::error_code(); }<br>
+<br>
</span>+  /// \brief If a file is parsed using a different method than doParse(),<br>
+  /// one must use this method to set the last error status, so that<br>
+  /// doParse will not be called twice. Only YAML reader uses this<br>
+  /// (because YAML reader does not read blobs but structured data).<br>
+  void setLastError(std::error_code err) { _lastError = err; }<br>
+<br>
+  std::error_code parse() {<br>
+    if (!_lastError.hasValue())<br>
+      _lastError = doParse();<br>
+    return _lastError.getValue();<br>
+  }<br>
+<br>
----------------<br>
It is not clear why we need "lastError".  You say it is for YAML, but the YAML reader could be changed to return some File object which you can later call parse() on.   With that gone, you don't need to parse() and doParse().  You can have just parse() which subclasses override to do the actual parsing.<br></blockquote><div><br></div><div>The reason to have parse() and doParse() is because I wanted to make it safe to call parse() more than once. Currently parse() is called more than once -- just after being instantiated and from Driver::link. If we provide only parse(), then all subclasses need to implement that guard themselves.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<a href="http://reviews.llvm.org/D6633" target="_blank">http://reviews.llvm.org/D6633</a><br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>
<br>
</div></div></blockquote></div></div></div>