Fix dangling reference in DwarfLinker.cpp. The original code
authorYaron Keren <yaron.keren@gmail.com>
Sat, 8 Aug 2015 21:03:19 +0000 (21:03 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Sat, 8 Aug 2015 21:03:19 +0000 (21:03 +0000)
commitc19de56ad9108a6c967eb7fd07237a3aae207fc5
tree4538b1162b8e998c8c76b49164b2c059814b8e34
parent1c8de8dde489a828e4c79a1e47928f015c835d15
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
tools/dsymutil/DwarfLinker.cpp