if some functions don't have debug info, we were outputing the same label at the...
authorAndrew Lenharth <andrewl@lenharth.org>
Thu, 3 Apr 2008 17:37:43 +0000 (17:37 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Thu, 3 Apr 2008 17:37:43 +0000 (17:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49176 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/DwarfWriter.cpp

index 010dfa0a793b34b9c6d3de6a14a951a25fe4a074..947b420cd514de524106bb803a97dc878ece175a 100644 (file)
@@ -2720,8 +2720,11 @@ public:
 
     // Emit label for the implicitly defined dbg.stoppoint at the start of
     // the function.
-    const SourceLineInfo &LineInfo = MMI->getSourceLines()[0];
-    Asm->printLabel(LineInfo.getLabelID());
+    const std::vector<SourceLineInfo> &LineInfos = MMI->getSourceLines();
+    if (!LineInfos.empty()) {
+      const SourceLineInfo &LineInfo = LineInfos[0];
+      Asm->printLabel(LineInfo.getLabelID());
+    }
   }
   
   /// EndFunction - Gather and emit post-function debug information.