[PATCH] D44607: Recompute invalidated iterator in insertTargetAndModeArgs
Hector Martin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 19 03:13:25 PDT 2018
marcan updated this revision to Diff 138888.
Repository:
rC Clang
https://reviews.llvm.org/D44607
Files:
tools/driver/driver.cpp
Index: tools/driver/driver.cpp
===================================================================
--- tools/driver/driver.cpp
+++ tools/driver/driver.cpp
@@ -212,20 +212,21 @@
// Put target and mode arguments at the start of argument list so that
// arguments specified in command line could override them. Avoid putting
// them at index 0, as an option like '-cc1' must remain the first.
- auto InsertionPoint = ArgVector.begin();
- if (InsertionPoint != ArgVector.end())
+ int InsertionPoint = 0;
+ if (ArgVector.size() > 0)
++InsertionPoint;
if (NameParts.DriverMode) {
// Add the mode flag to the arguments.
- ArgVector.insert(InsertionPoint,
+ ArgVector.insert(ArgVector.begin() + InsertionPoint,
GetStableCStr(SavedStrings, NameParts.DriverMode));
}
if (NameParts.TargetIsValid) {
const char *arr[] = {"-target", GetStableCStr(SavedStrings,
NameParts.TargetPrefix)};
- ArgVector.insert(InsertionPoint, std::begin(arr), std::end(arr));
+ ArgVector.insert(ArgVector.begin() + InsertionPoint,
+ std::begin(arr), std::end(arr));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44607.138888.patch
Type: text/x-patch
Size: 1188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180319/724db2c2/attachment-0001.bin>
More information about the cfe-commits
mailing list