[PATCH] D37511: [dwarfdump] Verify line table prologue
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 10:47:02 PDT 2017
JDevlieghere added inline comments.
================
Comment at: lib/DebugInfo/DWARF/DWARFVerifier.cpp:455
+ } else {
+ llvm_unreachable("Invalid index?");
+ }
----------------
JDevlieghere wrote:
> dblaikie wrote:
> > Don't branch-to-unreachable. Use an assert instead.
> >
> > Is the false return from getFileNameByIndex really impossible? (has the FileIndex been checked for validity? What other error paths does getFileNameByIndex have, if any?)
> Thanks, an assert definitely better expresses the intent. The only path that returns false is this:
> ```
> if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex))
> return false;
> ```
> 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.
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.
Repository:
rL LLVM
https://reviews.llvm.org/D37511
More information about the llvm-commits
mailing list