From 6a13ddbd9b2159303996db44db6045730d0fe479 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 2 Dec 2010 01:17:51 +0000 Subject: [PATCH] If tehre are not any line entry then do not try to emit .debug_line section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120637 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCContext.h | 3 +++ lib/MC/MCAsmStreamer.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index ae502baa1dd..60d5c0fae1f 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -180,6 +180,9 @@ namespace llvm { bool hasDwarfFiles(void) { return MCDwarfFiles.size() != 0; } + bool hasDwarfLines(void) { + return MCLineSectionOrder.size() != 0; + } const std::vector &getMCDwarfFiles() { return MCDwarfFiles; diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index c03f969e85f..02b666235e3 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -876,7 +876,7 @@ void MCAsmStreamer::EmitRawText(StringRef String) { void MCAsmStreamer::Finish() { // Dump out the dwarf file & directory tables and line tables. - if (getContext().hasDwarfFiles() && TLOF) { + if (getContext().hasDwarfFiles() && getContext().hasDwarfLines() && TLOF) { MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection(), NULL, PointerSize); } -- 2.34.1