[PATCH] D78627: [obj2yaml] - Zero initialize program headers. NFCI.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 01:34:24 PDT 2020
grimar marked an inline comment as done.
grimar added inline comments.
================
Comment at: llvm/lib/ObjectYAML/ELFEmitter.cpp:764
if (YamlPhdr.Offset) {
- if (!Fragments.empty() && *YamlPhdr.Offset > PhdrFileOffset)
+ if (!Fragments.empty() && *YamlPhdr.Offset > Fragments.front().Offset)
reportError("'Offset' for segment with index " + Twine(PhdrIdx) +
----------------
grimar wrote:
> jhenderson wrote:
> > Maybe worth pulling `Fragments.front().Offset` into a variable so that you don't have to repeat its call three times?
> OK, will do.
Ah, no, sorry, I can't do it. Otherwise we need to return the following line:
```
uint64_t PhdrFileOffset = Fragments.empty() ? 0 : Fragments.front().Offset;
```
i.e. need to check that `Fragments` is not empty again. This is probably a bit more complicated than inlining it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78627/new/
https://reviews.llvm.org/D78627
More information about the llvm-commits
mailing list