[PATCH] D81220: [DWARFYAML][debug_ranges] Make the "Offset" field optional.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 07:39:43 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:141-142
                                    Twine::utohexstr(CurrOffset) + ")");
-    if (DebugRanges.Offset > CurrOffset)
-      ZeroFillBytes(OS, DebugRanges.Offset - CurrOffset);
+    if (DebugRanges.Offset && *DebugRanges.Offset > CurrOffset)
+      ZeroFillBytes(OS, *DebugRanges.Offset - CurrOffset);
     for (auto Entry : DebugRanges.Entries) {
----------------
Can `ZeroFillBytes` cope with a size of zero? If so, this can be simplified to simply:
```
if (DebugRanges.Offset)
  ZeroFillBytes(OS, *DebugRanges.Offset - CurrOffset);
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81220/new/

https://reviews.llvm.org/D81220





More information about the llvm-commits mailing list