r188835 - Fix iterator invalidation. PR16935.
Eli Friedman
eli.friedman at gmail.com
Tue Aug 20 15:01:43 PDT 2013
Author: efriedma
Date: Tue Aug 20 17:01:43 2013
New Revision: 188835
URL: http://llvm.org/viewvc/llvm-project?rev=188835&view=rev
Log:
Fix iterator invalidation. PR16935.
Modified:
cfe/trunk/tools/driver/driver.cpp
Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=188835&r1=188834&r2=188835&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Tue Aug 20 17:01:43 2013
@@ -269,9 +269,10 @@ static void ParseProgName(SmallVectorImp
SmallVectorImpl<const char *>::iterator it = ArgVector.begin();
if (it != ArgVector.end())
++it;
- ArgVector.insert(it, SaveStringInSet(SavedStrings, Prefix));
- ArgVector.insert(it,
- SaveStringInSet(SavedStrings, std::string("-target")));
+ const char* Strings[] =
+ { SaveStringInSet(SavedStrings, std::string("-target")),
+ SaveStringInSet(SavedStrings, Prefix) };
+ ArgVector.insert(it, Strings, Strings + llvm::array_lengthof(Strings));
}
}
More information about the cfe-commits
mailing list