Fix the default libc++ header search path to be sysrooted.  Radar 9639692.

The -cxx-isystem path is not prefixed with the sysroot directory, so it's
not a good way for the driver to set the system default C++ search path.
Instead, add -stdlib as a cc1 option and teach the frontend how to find the
headers.  The driver can then just pass -stdlib through to "cc1".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133547 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 8079e19..cbbbc5c 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -205,19 +205,15 @@
                                              bool ObjCXXAutoRefCount) const {
   CXXStdlibType Type = GetCXXStdlibType(Args);
 
+  // Header search paths are handled by the mass of goop in InitHeaderSearch.
+
   switch (Type) {
   case ToolChain::CST_Libcxx:
-    CmdArgs.push_back("-nostdinc++");
-    CmdArgs.push_back("-cxx-isystem");
-    CmdArgs.push_back("/usr/include/c++/v1");
-      
     if (ObjCXXAutoRefCount)
       CmdArgs.push_back("-fobjc-arc-cxxlib=libc++");
     break;
 
   case ToolChain::CST_Libstdcxx:
-    // Currently handled by the mass of goop in InitHeaderSearch.
-
     if (ObjCXXAutoRefCount)
       CmdArgs.push_back("-fobjc-arc-cxxlib=libstdc++");
     break;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 41efccf..40ad2ca 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -330,6 +330,7 @@
       = types::isObjC(InputType) && isObjCAutoRefCount(Args);
     getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs, 
                                                 ObjCXXAutoRefCount);
+    Args.AddAllArgs(CmdArgs, options::OPT_stdlib_EQ);
   }
 
   // Add -Wp, and -Xassembler if using the preprocessor.