<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 9, 2017 at 8:32 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Rui Ueyama via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
<br>
> Author: ruiu<br>
> Date: Sun Jan  8 19:42:02 2017<br>
> New Revision: 291413<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=291413&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=291413&view=rev</a><br>
> Log:<br>
> Add linker-script-included files to reproduce tar files.<br>
><br>
> Previously, files added using INCLUDE directive weren't added<br>
> to reproduce archives. In this patch, I defined a function to<br>
> open a file and use that from Driver and LinkerScript.<br>
<br>
</span>Thanks!<br>
<span class=""><br>
> +  if (sys::fs::exists(Tok)) {<br>
> +    if (Optional<MemoryBufferRef> MB = readFile(Tok))<br>
> +      tokenize(*MB);<br>
> +    return;<br>
> +  }<br>
<br>
</span>Why do you need to use sys::fs::exists? Can't you just check the return<br>
of readFile?<br></blockquote><div><br></div><div>readFile prints out an error message if a given file cannot be opened. In this context, there's an alternative choice, so we don't want to emit an error message on the first failure.</div></div></div></div>