[DWARFYAML][debug_ranges] Fix inappropriate assertion. NFC.
authorXing GUO <higuoxing@gmail.com>
Sun, 7 Jun 2020 14:43:37 +0000 (22:43 +0800)
committerXing GUO <higuoxing@gmail.com>
Sun, 7 Jun 2020 14:45:52 +0000 (22:45 +0800)
llvm/lib/ObjectYAML/DWARFEmitter.cpp

index 29320f0..16bbad1 100644 (file)
@@ -123,7 +123,9 @@ void DWARFYAML::EmitDebugRanges(raw_ostream &OS, const DWARFYAML::Data &DI) {
   const size_t RangesOffset = OS.tell();
   for (auto DebugRanges : DI.DebugRanges) {
     const size_t CurrOffset = OS.tell() - RangesOffset;
-    assert(DebugRanges.Offset <= CurrOffset);
+    assert(DebugRanges.Offset >= CurrOffset &&
+           "Offset should be greater than or equal to the bytes that we have "
+           "written");
     if (DebugRanges.Offset > CurrOffset)
       ZeroFillBytes(OS, DebugRanges.Offset - CurrOffset);
     for (auto Entry : DebugRanges.Entries) {