[Driver] Avoid invalidated iterator in insertTargetAndModeArgs
authorSerge Pavlov <sepavloff@gmail.com>
Mon, 19 Mar 2018 16:13:43 +0000 (16:13 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Mon, 19 Mar 2018 16:13:43 +0000 (16:13 +0000)
commit826e833121d0f84a4ddf5f089e61bb8d3d79ef0e
tree2f7600f1dfd6a74a8ac860c4fa9bcf0d6d62a4b6
parent4b54e5fc386e5aa62725efe893d8ac9b9ee1dd01
[Driver] Avoid invalidated iterator in insertTargetAndModeArgs

Doing an .insert() can potentially invalidate iterators by reallocating the
vector's storage. When all the stars align just right, this causes segfaults
or glibc aborts.

Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082.

Patch by Hector Martin!

Differential Revision: https://reviews.llvm.org/D44607

llvm-svn: 327863
clang/tools/driver/driver.cpp