Driver: Eliminate uses of Arg::getIndex.

Also, fix a memory leak.

llvm-svn: 105963
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 19b1ec8..9accfe7 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -487,9 +487,8 @@
       if (getArchName() != A->getValue(Args, 0))
         continue;
 
-      // FIXME: The arg is leaked here, and we should have a nicer
-      // interface for this.
-      unsigned Prev, Index = Prev = A->getIndex() + 1;
+      unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(Args, 1));
+      unsigned Prev = Index;
       Arg *XarchArg = Opts.ParseOneArg(Args, Index);
 
       // If the argument parsing failed or more than one argument was
@@ -509,6 +508,8 @@
 
       XarchArg->setBaseArg(A);
       A = XarchArg;
+
+      DAL->AddSynthesizedArg(A);
     }
 
     // Sob. These is strictly gcc compatible for the time being. Apple