[PATCH] D33184: [DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 00:54:57 PDT 2017


>>  template <class ELFT>
>> +uint64_t ELFObjectFile<ELFT>::getSectionIndex(DataRefImpl Sec) const {
>> +  auto SectionsOrErr = EF.sections();
>> +  if (!SectionsOrErr) {
>> +    assert(false && "Unable to find section.");
>> +    return 0;
>> +  }
>
>That is an odd way to write an assert. You can just replace the entire
>if with
>
>assert(!SectionsOrErr && "Should be able to get the section table");
>

May be I am missing something, but I think that will not work if NDEBUG and LLVM_ENABLE_ABI_BREAKING_CHECKS are defined
together. In that case assert would expand to nothing and Expected<> value will be unchecked. That is why I wrote in this way initially.

FWIW, assert(false && "...") form is used in LLVM code sometimes.

>Other than that this is fine by me, but also needs an OK from someone
>more familiar with debug info.
>
>Cheers,
>Rafael

George.


More information about the llvm-commits mailing list