llvm.org GIT mirror llvm / c19de56
Fix dangling reference in DwarfLinker.cpp. The original code Seq.emplace_back(Seq.back()); does not work as planned, since Seq.back() may become a dangling reference when emplace_back is called and possibly reallocates vector. To avoid this, the vector allocation should be reserved first and only then used. This broke test/tools/dsymutil/X86/custom-line-table.test with Visual C++ 2013. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244405 91177308-0d34-0410-b5e6-96231b3b80d8 Yaron Keren 5 years ago
1 changed file(s) with 1 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
28832883 if (StopAddress != -1ULL && !Seq.empty()) {
28842884 // Insert end sequence row with the computed end address, but
28852885 // the same line as the previous one.
2886 Seq.reserve(Seq.size() + 1);
28862887 Seq.emplace_back(Seq.back());
28872888 Seq.back().Address = StopAddress;
28882889 Seq.back().EndSequence = 1;