If we're only emitting line tables for a particular CU then don't add
any ranges to the list of ranges for the CU as we don't want to emit
them anyway. This ensures that we will still emit ranges if we have
a compile unit compiled with only line tables and one compiled with
full debug info requested (we'll emit for the one with full debug info).
Update testcase metadata accordingly to continue emitting ranges.
llvm-svn: 202333
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 8dd25a0..f92b085 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -21,6 +21,7 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/DebugInfo.h"
+#include "llvm/DIBuilder.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSection.h"
@@ -249,7 +250,11 @@
bool hasContent() const { return !UnitDie->getChildren().empty(); }
/// addRange - Add an address range to the list of ranges for this unit.
- void addRange(RangeSpan Range) { CURanges.push_back(Range); }
+ void addRange(RangeSpan Range) {
+ // Only add a range for this unit if we're emitting full debug.
+ if (getCUNode().getEmissionKind() == DIBuilder::FullDebug)
+ CURanges.push_back(Range);
+ }
/// getRanges - Get the list of ranges for this unit.
const SmallVectorImpl<RangeSpan> &getRanges() const { return CURanges; }