If tehre are not any line entry then do not try to emit .debug_line section.
authorDevang Patel <dpatel@apple.com>
Thu, 2 Dec 2010 01:17:51 +0000 (01:17 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 2 Dec 2010 01:17:51 +0000 (01:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120637 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCContext.h
lib/MC/MCAsmStreamer.cpp

index ae502baa1dd6da006e71034d100819da532bf1fa..60d5c0fae1f3f6f1ada707db89bd56ce7e2fcda1 100644 (file)
@@ -180,6 +180,9 @@ namespace llvm {
     bool hasDwarfFiles(void) {
       return MCDwarfFiles.size() != 0;
     }
+    bool hasDwarfLines(void) {
+      return MCLineSectionOrder.size() != 0;
+    }
 
     const std::vector<MCDwarfFile *> &getMCDwarfFiles() {
       return MCDwarfFiles;
index c03f969e85f6d7345b007e9c2f66d26eefc9782d..02b666235e3792d970d70c187350d0639eff5d9c 100644 (file)
@@ -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);
   }