[llvm] d527690 - [DWARFYAML][debug_ranges] Fix inappropriate assertion. NFC.

Xing GUO via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 7 07:42:37 PDT 2020


Author: Xing GUO
Date: 2020-06-07T22:45:52+08:00
New Revision: d5276901030d42514f23fc63d98231facc4dfe5b

URL: https://github.com/llvm/llvm-project/commit/d5276901030d42514f23fc63d98231facc4dfe5b
DIFF: https://github.com/llvm/llvm-project/commit/d5276901030d42514f23fc63d98231facc4dfe5b.diff

LOG: [DWARFYAML][debug_ranges] Fix inappropriate assertion. NFC.

Added: 
    

Modified: 
    llvm/lib/ObjectYAML/DWARFEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index 29320f085b8a..16bbad172b08 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -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) {


        


More information about the llvm-commits mailing list