Redo part of r127137:
Pass down the correct C->getArgs, but keep it with the original
DerivedArgList type. Slightly adjust the MakeIndex call for the
different base type. This unbreaks the handling of --no-mangle on Darwin.

llvm-svn: 127142
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 5908659..572323a 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -308,10 +308,10 @@
 
   // Construct the list of abstract actions to perform for this compilation.
   if (Host->useDriverDriver())
-    BuildUniversalActions(C->getDefaultToolChain(), C->getInputArgs(),
+    BuildUniversalActions(C->getDefaultToolChain(), C->getArgs(),
                           C->getActions());
   else
-    BuildActions(C->getDefaultToolChain(), C->getInputArgs(), C->getActions());
+    BuildActions(C->getDefaultToolChain(), C->getArgs(), C->getActions());
 
   if (CCCPrintActions) {
     PrintActions(*C);
@@ -593,7 +593,7 @@
 }
 
 void Driver::BuildUniversalActions(const ToolChain &TC,
-                                   const InputArgList &Args,
+                                   const DerivedArgList &Args,
                                    ActionList &Actions) const {
   llvm::PrettyStackTraceString CrashInfo("Building universal build actions");
   // Collect the list of architectures. Duplicates are allowed, but should only
@@ -688,7 +688,7 @@
   }
 }
 
-void Driver::BuildActions(const ToolChain &TC, const InputArgList &Args,
+void Driver::BuildActions(const ToolChain &TC, const DerivedArgList &Args,
                           ActionList &Actions) const {
   llvm::PrettyStackTraceString CrashInfo("Building compilation actions");
   // Start by constructing the list of inputs and their types.
@@ -802,7 +802,7 @@
   if (CCCIsCPP && Inputs.empty()) {
     // If called as standalone preprocessor, stdin is processed
     // if no other input is present.
-    unsigned Index = Args.MakeIndex("-");
+    unsigned Index = Args.getBaseArgs().MakeIndex("-");
     Arg *A = Opts->ParseOneArg(Args, Index);
     A->claim();
     Inputs.push_back(std::make_pair(types::TY_C, A));