Slightly improve the code to derive target from program name to not

fault if no arguments are given.

llvm-svn: 134618
This commit is contained in:
Joerg Sonnenberger 2011-07-07 16:57:26 +00:00
parent e0cbf7409c
commit 39ec119132
1 changed files with 5 additions and 3 deletions

View File

@ -327,9 +327,11 @@ static void ParseProgName(llvm::SmallVectorImpl<const char *> &ArgVector,
std::string IgnoredError;
if (llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError)) {
ArgVector.insert(&ArgVector[1],
SaveStringInSet(SavedStrings, Prefix));
ArgVector.insert(&ArgVector[1],
llvm::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("-ccc-host-triple")));
}
}