diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index fd0181e66ab..9dbb7b382e6 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -469,7 +469,7 @@ namespace llvm { void setGenDwarfFileNumber(unsigned FileNumber) { GenDwarfFileNumber = FileNumber; } - MapVector> & + const MapVector> & getGenDwarfSectionSyms() { return SectionStartEndSyms; } diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp index 9cee2e60696..d99a6c4836b 100644 --- a/lib/MC/MCParser/ELFAsmParser.cpp +++ b/lib/MC/MCParser/ELFAsmParser.cpp @@ -532,9 +532,7 @@ EndStmt: getStreamer().SwitchSection(ELFSection, Subsection); if (getContext().getGenDwarfForAssembly()) { - auto &Sections = getContext().getGenDwarfSectionSyms(); - auto InsertResult = Sections.insert( - std::make_pair(ELFSection, std::make_pair(nullptr, nullptr))); + auto InsertResult = getContext().addGenDwarfSection(ELFSection); if (InsertResult.second) { if (getContext().getDwarfVersion() <= 2) Warning(loc, "DWARF2 only supports one section per compilation unit");