diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index 010dfa0a793..947b420cd51 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -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 &LineInfos = MMI->getSourceLines(); + if (!LineInfos.empty()) { + const SourceLineInfo &LineInfo = LineInfos[0]; + Asm->printLabel(LineInfo.getLabelID()); + } } /// EndFunction - Gather and emit post-function debug information.