<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 6, 2017 at 10:47 AM Jonas Devlieghere via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">JDevlieghere added inline comments.<br>
<br>
<br>
================<br>
Comment at: lib/DebugInfo/DWARF/DWARFVerifier.cpp:455<br>
+      } else {<br>
+        llvm_unreachable("Invalid index?");<br>
+      }<br>
----------------<br>
JDevlieghere wrote:<br>
> dblaikie wrote:<br>
> > Don't branch-to-unreachable. Use an assert instead.<br>
> ><br>
> > Is the false return from getFileNameByIndex really impossible? (has the FileIndex been checked for validity? What other error paths does getFileNameByIndex have, if any?)<br>
> Thanks, an assert definitely better expresses the intent. The only path that returns false is this:<br>
> ```<br>
>   if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex))<br>
>     return false;<br>
> ```<br>
> The `FileLineInfoKind` is hard-coded so that can't trigger it. The index can't really be invalid either as we're iterating over the list of indices. If this returns false here it must be a programmer error.<br>
What about the unused variable though? I need the function call to populate the string, so I'd have to assign it to a bool that's only used in the assert.<br></blockquote><div><br>Generally a "(void)Var;" next to the assert is done to suppress the unused variable warning.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D37511" rel="noreferrer" target="_blank">https://reviews.llvm.org/D37511</a><br>
<br>
<br>
<br>
</blockquote></div></div>