[PATCH] D44607: Recompute invalidated iterator in insertTargetAndModeArgs
Serge Pavlov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 19 09:16:21 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327863: [Driver] Avoid invalidated iterator in insertTargetAndModeArgs (authored by sepavloff, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D44607?vs=138888&id=138952#toc
Repository:
rL LLVM
https://reviews.llvm.org/D44607
Files:
cfe/trunk/tools/driver/driver.cpp
Index: cfe/trunk/tools/driver/driver.cpp
===================================================================
--- cfe/trunk/tools/driver/driver.cpp
+++ cfe/trunk/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.138952.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180319/7e8cdb35/attachment.bin>
More information about the cfe-commits
mailing list