[llvm] r197780 - Ranges in the .debug_range section need to have begin and end labels,

Eric Christopher echristo at gmail.com
Thu Dec 19 20:34:22 PST 2013


Author: echristo
Date: Thu Dec 19 22:34:22 2013
New Revision: 197780

URL: http://llvm.org/viewvc/llvm-project?rev=197780&view=rev
Log:
Ranges in the .debug_range section need to have begin and end labels,
assert that this is so.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=197780&r1=197779&r2=197780&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Dec 19 22:34:22 2013
@@ -2938,14 +2938,12 @@ void DwarfDebug::emitDebugRanges() {
                RE = List.getRanges().end();
            RI != RE; ++RI) {
         const RangeSpan &Range = *RI;
-        // We occasionally have ranges without begin/end labels.
-        // FIXME: Verify and fix.
         const MCSymbol *Begin = Range.getStart();
         const MCSymbol *End = Range.getEnd();
-        Begin ? Asm->OutStreamer.EmitSymbolValue(Begin, Size)
-              : Asm->OutStreamer.EmitIntValue(0, Size);
-        End ? Asm->OutStreamer.EmitSymbolValue(End, Size)
-            : Asm->OutStreamer.EmitIntValue(0, Size);
+        assert(Begin && "Range without a begin symbol?");
+        assert(End && "Range without an end symbol?");
+        Asm->OutStreamer.EmitSymbolValue(Begin, Size);
+        Asm->OutStreamer.EmitSymbolValue(End, Size);
       }
 
       // And terminate the list with two 0 values.
@@ -2960,15 +2958,12 @@ void DwarfDebug::emitDebugRanges() {
       const SmallVectorImpl<RangeSpan> &Ranges = TheCU->getRanges();
       for (uint32_t i = 0, e = Ranges.size(); i != e; ++i) {
         RangeSpan Range = Ranges[i];
-
-        // We occasionally have ranges without begin/end labels.
-        // FIXME: Verify and fix.
         const MCSymbol *Begin = Range.getStart();
         const MCSymbol *End = Range.getEnd();
-        Begin ? Asm->OutStreamer.EmitSymbolValue(Begin, Size)
-              : Asm->OutStreamer.EmitIntValue(0, Size);
-        End ? Asm->OutStreamer.EmitSymbolValue(End, Size)
-            : Asm->OutStreamer.EmitIntValue(0, Size);
+        assert(Begin && "Range without a begin symbol?");
+        assert(End && "Range without an end symbol?");
+        Asm->OutStreamer.EmitSymbolValue(Begin, Size);
+        Asm->OutStreamer.EmitSymbolValue(End, Size);
       }
       // And terminate the list with two 0 values.
       Asm->OutStreamer.EmitIntValue(0, Size);





More information about the llvm-commits mailing list