[cfe-commits] r134618 - /cfe/trunk/tools/driver/driver.cpp

Joerg Sonnenberger joerg at bec.de
Thu Jul 7 09:57:27 PDT 2011


Author: joerg
Date: Thu Jul  7 11:57:26 2011
New Revision: 134618

URL: http://llvm.org/viewvc/llvm-project?rev=134618&view=rev
Log:
Slightly improve the code to derive target from program name to not
fault if no arguments are given.

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=134618&r1=134617&r2=134618&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Thu Jul  7 11:57:26 2011
@@ -327,9 +327,11 @@
 
   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")));
   }
 }





More information about the cfe-commits mailing list