Driver/Frontend: Add support for -mllvm, which forwards options to the LLVM option parser.
 - Note that this is a behavior change, previously -mllvm at the driver level forwarded to clang -cc1. The driver does a little magic to make sure that '-mllvm -disable-llvm-optzns' works correctly, but other users will need to be updated to use -Xclang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101354 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp
index e9663f4..41f2997 100644
--- a/tools/driver/cc1_main.cpp
+++ b/tools/driver/cc1_main.cpp
@@ -241,6 +241,19 @@
     return 0;
   }
 
+  // Honor -mllvm.
+  //
+  // FIXME: Remove this, one day.
+  if (!Clang->getFrontendOpts().LLVMArgs.empty()) {
+    unsigned NumArgs = Clang->getFrontendOpts().LLVMArgs.size();
+    const char **Args = new const char*[NumArgs + 2];
+    Args[0] = "clang (LLVM option parsing)";
+    for (unsigned i = 0; i != NumArgs; ++i)
+      Args[i + 1] = Clang->getFrontendOpts().LLVMArgs[i].c_str();
+    Args[NumArgs + 1] = 0;
+    llvm::cl::ParseCommandLineOptions(NumArgs + 1, (char**) Args);
+  }
+
   // Create the actual diagnostics engine.
   Clang->createDiagnostics(ArgEnd - ArgBegin, const_cast<char**>(ArgBegin));
   if (!Clang->hasDiagnostics())