Index: lib/DebugInfo/DWARF/DWARFContext.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFContext.cpp +++ lib/DebugInfo/DWARF/DWARFContext.cpp @@ -48,6 +48,7 @@ #include "llvm/Support/raw_ostream.h" #include #include +#include #include #include #include @@ -1248,7 +1249,9 @@ StringRef TUIndexSection; StringRef LineStringSection; - SmallVector, 4> UncompressedSections; + // A container holding section data whose iterators are not invalidated when + // new decompressed sections are added. + std::forward_list> UncompressedSections; StringRef *mapSectionToMember(StringRef Name) { if (DWARFSection *Sec = mapNameToDWARFSection(Name)) @@ -1286,12 +1289,12 @@ if (!Decompressor) return Decompressor.takeError(); - SmallString<32> Out; + SmallString<0> Out; if (auto Err = Decompressor->resizeAndDecompress(Out)) return Err; - UncompressedSections.emplace_back(std::move(Out)); - Data = UncompressedSections.back(); + UncompressedSections.push_front(std::move(Out)); + Data = UncompressedSections.front(); return Error::success(); }