r361278 - [clang][Darwin] Refactor header search path logic into the driver

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 14:30:49 PDT 2019


On Tue, 21 May 2019 at 13:43, Louis Dionne via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Thanks a lot for looking into this. I was trying to reproduce in a Docker
> container but you were faster than me.
>
> I'm not 100% sure I understand the fix, though. Am I correct that
> -stdlib=platform means that the standard library for the platform we're
> compiling for (darwin16 after your change) is what's going to be used? That
> would make it use libc++ for both the libc++ and the libstdc++ tests, which
> is the part I don't understand.
>

It means to use the platform-specific logic to pick the default, even if
CLANG_DEFAULT_CXX_STDLIB was defined at configure-time and would usually
override that logic.

The last two checks in darwin-header-search-libstdcxx.cpp are both using
libc++ (they were both using libc++ on submit on recent Darwin, and now do
so portably). I think that's intentional: they seem to be checking that we
don't produce a warning that we can't find the libstdc++ headers when we
weren't supposed to be using libstdc++ in the first place.


> Louis
>
> On May 21, 2019, at 16:08, Richard Smith <richard at metafoo.co.uk> wrote:
>
> Awesome!
>
> But... this resulted in two test failures for me. I've fixed them in
> r361301, can you check that's correct?
>
> On Tue, 21 May 2019 at 10:45, Louis Dionne via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: ldionne
>> Date: Tue May 21 10:48:04 2019
>> New Revision: 361278
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=361278&view=rev
>> Log:
>> [clang][Darwin] Refactor header search path logic into the driver
>>
>> Summary:
>> This commit moves the logic for determining system, resource and C++
>> header search paths from CC1 to the driver. This refactor has already
>> been made for several platforms, but Darwin had been left behind.
>>
>> This refactor tries to implement the previous search path logic with
>> perfect accuracy. In particular, the order of all include paths inside
>> CC1 and all paths that were skipped because nonexistent are conserved
>> after the refactor. This change was also tested against a code base
>> of significant size and revealed no problems.
>>
>> Reviewers: jfb, arphaman
>>
>> Subscribers: nemanjai, javed.absar, kbarton, christof, jkorous,
>> dexonsmith, jsji, cfe-commits
>>
>> Tags: #clang
>>
>> Differential Revision: https://reviews.llvm.org/D61963
>>
>> Added:
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/arm64-apple-darwin10/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/arm64-apple-darwin10/.keep
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v6/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v6/.keep
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v7/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v7/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64/.keep
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/i686-apple-darwin8/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/i686-apple-darwin8/.keep
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/.keep
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/.keep
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/.keep
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/include/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/v1/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/v1/.keep
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/
>>     cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/
>>
>> cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/.keep
>>     cfe/trunk/test/Driver/darwin-header-search-libcxx.cpp
>>     cfe/trunk/test/Driver/darwin-header-search-libstdcxx.cpp
>>     cfe/trunk/test/Driver/darwin-header-search-system.cpp
>> Removed:
>>     cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
>> Modified:
>>     cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
>>     cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>>     cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
>>     cfe/trunk/lib/Driver/ToolChains/Darwin.h
>>     cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>>     cfe/trunk/test/Driver/darwin-stdlib.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=361278&r1=361277&r2=361278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue May 21
>> 10:48:04 2019
>> @@ -453,4 +453,9 @@ def warn_drv_msp430_hwmult_no_device : W
>>    "specify a MSP430 device, or -mhwmult to set hardware multiply type "
>>    "explicitly.">, InGroup<InvalidCommandLineArgument>;
>>
>> +def warn_drv_libstdcxx_not_found : Warning<
>> +  "include path for libstdc++ headers not found; pass '-stdlib=libc++'
>> on the "
>> +  "command line to use the libc++ standard library instead">,
>> +  InGroup<DiagGroup<"stdlibcxx-not-found">>;
>> +
>>  }
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=361278&r1=361277&r2=361278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue May 21
>> 10:48:04 2019
>> @@ -232,11 +232,6 @@ def err_invalid_vfs_overlay : Error<
>>  def warn_option_invalid_ocl_version : Warning<
>>    "OpenCL version %0 does not support the option '%1'">,
>> InGroup<Deprecated>;
>>
>> -def warn_stdlibcxx_not_found : Warning<
>> -  "include path for stdlibc++ headers not found; pass '-stdlib=libc++'
>> on the "
>> -  "command line to use the libc++ standard library instead">,
>> -  InGroup<DiagGroup<"stdlibcxx-not-found">>;
>> -
>>  def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
>>  def err_function_needs_feature : Error<
>>    "always_inline function %1 requires target feature '%2', but would "
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Darwin.cpp?rev=361278&r1=361277&r2=361278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp Tue May 21 10:48:04 2019
>> @@ -11,6 +11,7 @@
>>  #include "CommonArgs.h"
>>  #include "clang/Basic/AlignedAllocation.h"
>>  #include "clang/Basic/ObjCRuntime.h"
>> +#include "clang/Config/config.h"
>>  #include "clang/Driver/Compilation.h"
>>  #include "clang/Driver/Driver.h"
>>  #include "clang/Driver/DriverDiagnostic.h"
>> @@ -1804,6 +1805,84 @@ void Darwin::AddDeploymentTarget(Derived
>>    }
>>  }
>>
>> +void DarwinClang::AddClangSystemIncludeArgs(const llvm::opt::ArgList
>> &DriverArgs,
>> +                                            llvm::opt::ArgStringList
>> &CC1Args) const {
>> +  const Driver &D = getDriver();
>> +
>> +  llvm::StringRef Sysroot = "/";
>> +  if (const Arg *A = DriverArgs.getLastArg(options::OPT_isysroot))
>> +    Sysroot = A->getValue();
>> +
>> +  bool NoStdInc = DriverArgs.hasArg(options::OPT_nostdinc);
>> +  bool NoStdlibInc = DriverArgs.hasArg(options::OPT_nostdlibinc);
>> +  bool NoBuiltinInc = DriverArgs.hasArg(options::OPT_nobuiltininc);
>> +
>> +  // Add <sysroot>/usr/local/include
>> +  if (!NoStdInc && !NoStdlibInc) {
>> +      SmallString<128> P(Sysroot);
>> +      llvm::sys::path::append(P, "usr", "local", "include");
>> +      addSystemInclude(DriverArgs, CC1Args, P);
>> +  }
>> +
>> +  // Add the Clang builtin headers (<resource>/include)
>> +  if (!NoStdInc && !NoBuiltinInc) {
>> +    SmallString<128> P(D.ResourceDir);
>> +    llvm::sys::path::append(P, "include");
>> +    addSystemInclude(DriverArgs, CC1Args, P);
>> +  }
>> +
>> +  if (NoStdInc || NoStdlibInc)
>> +    return;
>> +
>> +  // Check for configure-time C include directories.
>> +  llvm::StringRef CIncludeDirs(C_INCLUDE_DIRS);
>> +  if (!CIncludeDirs.empty()) {
>> +    llvm::SmallVector<llvm::StringRef, 5> dirs;
>> +    CIncludeDirs.split(dirs, ":");
>> +    for (llvm::StringRef dir : dirs) {
>> +      llvm::StringRef Prefix =
>> +          llvm::sys::path::is_absolute(dir) ? llvm::StringRef(Sysroot) :
>> "";
>> +      addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
>> +    }
>> +  } else {
>> +    // Otherwise, add <sysroot>/usr/include.
>> +    SmallString<128> P(Sysroot);
>> +    llvm::sys::path::append(P, "usr", "include");
>> +    addExternCSystemInclude(DriverArgs, CC1Args, P.str());
>> +  }
>> +}
>> +
>> +bool DarwinClang::AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList
>> &DriverArgs,
>> +                                              llvm::opt::ArgStringList
>> &CC1Args,
>> +                                              llvm::SmallString<128>
>> Base,
>> +                                              llvm::StringRef Version,
>> +                                              llvm::StringRef ArchDir,
>> +                                              llvm::StringRef BitDir)
>> const {
>> +  llvm::sys::path::append(Base, Version);
>> +
>> +  // Add the base dir
>> +  addSystemInclude(DriverArgs, CC1Args, Base);
>> +
>> +  // Add the multilib dirs
>> +  {
>> +    llvm::SmallString<128> P = Base;
>> +    if (!ArchDir.empty())
>> +      llvm::sys::path::append(P, ArchDir);
>> +    if (!BitDir.empty())
>> +      llvm::sys::path::append(P, BitDir);
>> +    addSystemInclude(DriverArgs, CC1Args, P);
>> +  }
>> +
>> +  // Add the backward dir
>> +  {
>> +    llvm::SmallString<128> P = Base;
>> +    llvm::sys::path::append(P, "backward");
>> +    addSystemInclude(DriverArgs, CC1Args, P);
>> +  }
>> +
>> +  return getVFS().exists(Base);
>> +}
>> +
>>  void DarwinClang::AddClangCXXStdlibIncludeArgs(
>>      const llvm::opt::ArgList &DriverArgs,
>>      llvm::opt::ArgStringList &CC1Args) const {
>> @@ -1811,29 +1890,95 @@ void DarwinClang::AddClangCXXStdlibInclu
>>    // CC1Args.
>>    // FIXME: this should not be necessary, remove usages in the frontend
>>    //        (e.g. HeaderSearchOptions::UseLibcxx) and don't pipe -stdlib.
>> +  //        Also check whether this is used for setting library search
>> paths.
>>    ToolChain::AddClangCXXStdlibIncludeArgs(DriverArgs, CC1Args);
>>
>>    if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
>>        DriverArgs.hasArg(options::OPT_nostdincxx))
>>      return;
>>
>> +  llvm::SmallString<128> Sysroot;
>> +  if (const Arg *A = DriverArgs.getLastArg(options::OPT_isysroot)) {
>> +    Sysroot = A->getValue();
>> +  } else {
>> +    Sysroot = "/";
>> +  }
>> +
>>    switch (GetCXXStdlibType(DriverArgs)) {
>>    case ToolChain::CST_Libcxx: {
>> -    llvm::StringRef InstallDir = getDriver().getInstalledDir();
>> -    if (InstallDir.empty())
>> -      break;
>> -    // On Darwin, libc++ may be installed alongside the compiler in
>> -    // include/c++/v1.
>> -    // Get from 'foo/bin' to 'foo/include/c++/v1'.
>> -    SmallString<128> P = InstallDir;
>> -    // Note that InstallDir can be relative, so we have to '..' and not
>> -    // parent_path.
>> -    llvm::sys::path::append(P, "..", "include", "c++", "v1");
>> -    addSystemInclude(DriverArgs, CC1Args, P);
>> +    // On Darwin, libc++ is installed alongside the compiler in
>> +    // include/c++/v1, so get from '<install>/bin' to
>> '<install>/include/c++/v1'.
>> +    {
>> +      llvm::SmallString<128> P =
>> llvm::StringRef(getDriver().getInstalledDir());
>> +      // Note that P can be relative, so we have to '..' and not
>> parent_path.
>> +      llvm::sys::path::append(P, "..", "include", "c++", "v1");
>> +      addSystemInclude(DriverArgs, CC1Args, P);
>> +    }
>> +    // Also add <sysroot>/usr/include/c++/v1 unless -nostdinc is used,
>> +    // to match the legacy behavior in CC1.
>> +    if (!DriverArgs.hasArg(options::OPT_nostdinc)) {
>> +      llvm::SmallString<128> P = Sysroot;
>> +      llvm::sys::path::append(P, "usr", "include", "c++", "v1");
>> +      addSystemInclude(DriverArgs, CC1Args, P);
>> +    }
>>      break;
>>    }
>> +
>>    case ToolChain::CST_Libstdcxx:
>> -    // FIXME: should we do something about it?
>> +    llvm::SmallString<128> UsrIncludeCxx = Sysroot;
>> +    llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
>> +
>> +    llvm::Triple::ArchType arch = getTriple().getArch();
>> +    bool IsBaseFound = true;
>> +    switch (arch) {
>> +    default: break;
>> +
>> +    case llvm::Triple::ppc:
>> +    case llvm::Triple::ppc64:
>> +      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args,
>> UsrIncludeCxx,
>> +                                                "4.2.1",
>> +                                                "powerpc-apple-darwin10",
>> +                                                arch ==
>> llvm::Triple::ppc64 ? "ppc64" : "");
>> +      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args,
>> UsrIncludeCxx,
>> +                                                "4.0.0",
>> "powerpc-apple-darwin10",
>> +                                                 arch ==
>> llvm::Triple::ppc64 ? "ppc64" : "");
>> +      break;
>> +
>> +    case llvm::Triple::x86:
>> +    case llvm::Triple::x86_64:
>> +      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args,
>> UsrIncludeCxx,
>> +                                                "4.2.1",
>> +                                                "i686-apple-darwin10",
>> +                                                arch ==
>> llvm::Triple::x86_64 ? "x86_64" : "");
>> +      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args,
>> UsrIncludeCxx,
>> +                                                "4.0.0",
>> "i686-apple-darwin8",
>> +                                                 "");
>> +      break;
>> +
>> +    case llvm::Triple::arm:
>> +    case llvm::Triple::thumb:
>> +      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args,
>> UsrIncludeCxx,
>> +                                                "4.2.1",
>> +                                                "arm-apple-darwin10",
>> +                                                "v7");
>> +      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args,
>> UsrIncludeCxx,
>> +                                                "4.2.1",
>> +                                                "arm-apple-darwin10",
>> +                                                 "v6");
>> +      break;
>> +
>> +    case llvm::Triple::aarch64:
>> +      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args,
>> UsrIncludeCxx,
>> +                                                "4.2.1",
>> +                                                "arm64-apple-darwin10",
>> +                                                "");
>> +      break;
>> +    }
>> +
>> +    if (!IsBaseFound) {
>> +      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
>> +    }
>> +
>>      break;
>>    }
>>  }
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Darwin.h?rev=361278&r1=361277&r2=361278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/ToolChains/Darwin.h (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/Darwin.h Tue May 21 10:48:04 2019
>> @@ -503,6 +503,9 @@ public:
>>        const llvm::opt::ArgList &DriverArgs,
>>        llvm::opt::ArgStringList &CC1Args) const override;
>>
>> +  void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
>> +                                 llvm::opt::ArgStringList &CC1Args)
>> const override;
>> +
>>    void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
>>                             llvm::opt::ArgStringList &CmdArgs) const
>> override;
>>
>> @@ -529,6 +532,13 @@ private:
>>                                 llvm::opt::ArgStringList &CmdArgs,
>>                                 StringRef Sanitizer,
>>                                 bool shared = true) const;
>> +
>> +  bool AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList &DriverArgs,
>> +                                   llvm::opt::ArgStringList &CC1Args,
>> +                                   llvm::SmallString<128> Base,
>> +                                   llvm::StringRef Version,
>> +                                   llvm::StringRef ArchDir,
>> +                                   llvm::StringRef BitDir) const;
>>  };
>>
>>  } // end namespace toolchains
>>
>> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=361278&r1=361277&r2=361278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
>> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue May 21 10:48:04 2019
>> @@ -210,6 +210,10 @@ void InitHeaderSearch::AddDefaultCInclud
>>                                              const HeaderSearchOptions
>> &HSOpts) {
>>    llvm::Triple::OSType os = triple.getOS();
>>
>> +  if (triple.isOSDarwin()) {
>> +    llvm_unreachable("Include management is handled in the driver.");
>> +  }
>> +
>>    if (HSOpts.UseStandardSystemIncludes) {
>>      switch (os) {
>>      case llvm::Triple::CloudABI:
>> @@ -365,49 +369,7 @@ void InitHeaderSearch::AddDefaultCPlusPl
>>    // FIXME: temporary hack: hard-coded paths.
>>
>>    if (triple.isOSDarwin()) {
>> -    bool IsBaseFound = true;
>> -    switch (triple.getArch()) {
>> -    default: break;
>> -
>> -    case llvm::Triple::ppc:
>> -    case llvm::Triple::ppc64:
>> -      IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
>> -
>> "powerpc-apple-darwin10", "",
>> -                                                "ppc64", triple);
>> -      IsBaseFound |=
>> AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
>> -
>>  "powerpc-apple-darwin10", "",
>> -                                                 "ppc64", triple);
>> -      break;
>> -
>> -    case llvm::Triple::x86:
>> -    case llvm::Triple::x86_64:
>> -      IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
>> -                                                "i686-apple-darwin10",
>> "",
>> -                                                "x86_64", triple);
>> -      IsBaseFound |= AddGnuCPlusPlusIncludePaths(
>> -          "/usr/include/c++/4.0.0", "i686-apple-darwin8", "", "",
>> triple);
>> -      break;
>> -
>> -    case llvm::Triple::arm:
>> -    case llvm::Triple::thumb:
>> -      IsBaseFound = AddGnuCPlusPlusIncludePaths(
>> -          "/usr/include/c++/4.2.1", "arm-apple-darwin10", "v7", "",
>> triple);
>> -      IsBaseFound |= AddGnuCPlusPlusIncludePaths(
>> -          "/usr/include/c++/4.2.1", "arm-apple-darwin10", "v6", "",
>> triple);
>> -      break;
>> -
>> -    case llvm::Triple::aarch64:
>> -      IsBaseFound = AddGnuCPlusPlusIncludePaths(
>> -          "/usr/include/c++/4.2.1", "arm64-apple-darwin10", "", "",
>> triple);
>> -      break;
>> -    }
>> -    // Warn when compiling pure C++ / Objective-C++ only.
>> -    if (!IsBaseFound &&
>> -        !(LangOpts.CUDA || LangOpts.OpenCL || LangOpts.RenderScript)) {
>> -      Headers.getDiags().Report(SourceLocation(),
>> -                                diag::warn_stdlibcxx_not_found);
>> -    }
>> -    return;
>> +    llvm_unreachable("Include management is handled in the driver.");
>>    }
>>
>>    switch (os) {
>> @@ -464,6 +426,16 @@ void InitHeaderSearch::AddDefaultInclude
>>      break;
>>    }
>>
>> +  // All header search logic is handled in the Driver for Darwin.
>> +  if (triple.isOSDarwin()) {
>> +    if (HSOpts.UseStandardSystemIncludes) {
>> +      // Add the default framework include paths on Darwin.
>> +      AddPath("/System/Library/Frameworks", System, true);
>> +      AddPath("/Library/Frameworks", System, true);
>> +    }
>> +    return;
>> +  }
>> +
>>    if (Lang.CPlusPlus && !Lang.AsmPreprocessor &&
>>        HSOpts.UseStandardCXXIncludes && HSOpts.UseStandardSystemIncludes)
>> {
>>      if (HSOpts.UseLibcxx) {
>> @@ -474,14 +446,6 @@ void InitHeaderSearch::AddDefaultInclude
>>    }
>>
>>    AddDefaultCIncludePaths(triple, HSOpts);
>> -
>> -  // Add the default framework include paths on Darwin.
>> -  if (HSOpts.UseStandardSystemIncludes) {
>> -    if (triple.isOSDarwin()) {
>> -      AddPath("/System/Library/Frameworks", System, true);
>> -      AddPath("/Library/Frameworks", System, true);
>> -    }
>> -  }
>>  }
>>
>>  /// RemoveDuplicates - If there are duplicate directory entries in the
>> specified
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c++/4.2.1/arm64-apple-darwin10/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/include/c%2B%2B/4.2.1/arm64-apple-darwin10/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_aarch64/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v6/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c%2B%2B/4.2.1/arm-apple-darwin10/v6/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c++/4.2.1/arm-apple-darwin10/v7/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/include/c%2B%2B/4.2.1/arm-apple-darwin10/v7/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_arm/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c%2B%2B/4.0.0/powerpc-apple-darwin10/ppc64/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/include/c%2B%2B/4.2.1/powerpc-apple-darwin10/ppc64/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_ppc/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.0.0/i686-apple-darwin8/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c%2B%2B/4.0.0/i686-apple-darwin8/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/include/c%2B%2B/4.2.1/i686-apple-darwin10/x86_64/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_libstdcxx_x86/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/include/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libcxx/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/include/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_no_libstdcxx/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added: cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/include/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added: cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/include/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/include/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_and_usr_local/usr/local/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/include/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_sdk_usr_local/usr/local/lib/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added: cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/bin/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c++/v1/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain/usr/include/c%2B%2B/v1/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/.keep
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin/.keep?rev=361278&view=auto
>>
>> ==============================================================================
>>     (empty)
>>
>> Added: cfe/trunk/test/Driver/darwin-header-search-libcxx.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-header-search-libcxx.cpp?rev=361278&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/Driver/darwin-header-search-libcxx.cpp (added)
>> +++ cfe/trunk/test/Driver/darwin-header-search-libcxx.cpp Tue May 21
>> 10:48:04 2019
>> @@ -0,0 +1,78 @@
>> +// General tests that the header search paths for libc++ detected by the
>> driver
>> +// and passed to CC1 are correct on Darwin platforms.
>> +
>> +// Check without a sysroot and without headers alongside the installation
>> +// (no include path should be added, and no warning or error).
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -stdlib=libc++ \
>> +// RUN:     -ccc-install-dir
>> %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
>> +// RUN:   | FileCheck --check-prefix=CHECK-LIBCXX-NONE %s
>> +// CHECK-LIBCXX-NONE: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +
>> +// Check with only headers alongside the installation (those should be
>> used,
>> +// but we should still add /usr/include/c++/v1 after to preserve legacy).
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -stdlib=libc++ \
>> +// RUN:     -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
>> +// RUN:   | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain
>> --check-prefix=CHECK-LIBCXX-TOOLCHAIN-1 %s
>> +// CHECK-LIBCXX-TOOLCHAIN-1: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBCXX-TOOLCHAIN-1: "-internal-isystem"
>> "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
>> +// CHECK-LIBCXX-TOOLCHAIN-1: "-internal-isystem" "/usr/include/c++/v1"
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -stdlib=libc++ \
>> +// RUN:     -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_no_libcxx \
>> +// RUN:   | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain
>> --check-prefix=CHECK-LIBCXX-TOOLCHAIN-2 %s
>> +// CHECK-LIBCXX-TOOLCHAIN-2: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBCXX-TOOLCHAIN-2: "-internal-isystem"
>> "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
>> +
>> +// Check with both headers in the sysroot and headers alongside the
>> installation
>> +// (the headers in <sysroot> should be added after the toolchain
>> headers).
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -stdlib=libc++ \
>> +// RUN:     -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
>> +// RUN:               -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
>> +// RUN:
>>  --check-prefix=CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1 %s
>> +// CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1: "-internal-isystem"
>> "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
>> +// CHECK-LIBCXX-SYSROOT_AND_TOOLCHAIN-1: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/v1"
>> +
>> +// Make sure that using -nostdinc or -nostdlibinc will drop the
>> non-toolchain
>> +// C++ library include paths (so all except
>> <toolchain>/usr/bin/../include/c++/v1).
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr \
>> +// RUN:     -nostdinc \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
>> +// RUN:               -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
>> +// RUN:               --check-prefix=CHECK-LIBCXX-NOSTDINC %s
>> +// CHECK-LIBCXX-NOSTDINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBCXX-NOSTDINC: "-internal-isystem"
>> "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
>> +// CHECK-LIBCXX-NOSTDINC-NOT: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/v1"
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr \
>> +// RUN:     -nostdinc \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr \
>> +// RUN:               -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \
>> +// RUN:               --check-prefix=CHECK-LIBCXX-NOSTDLIBINC %s
>> +// CHECK-LIBCXX-NOSTDLIBINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBCXX-NOSTDLIBINC: "-internal-isystem"
>> "[[TOOLCHAIN]]/usr/bin/../include/c++/v1"
>> +// CHECK-LIBCXX-NOSTDLIBINC-NOT: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/v1"
>>
>> Added: cfe/trunk/test/Driver/darwin-header-search-libstdcxx.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-header-search-libstdcxx.cpp?rev=361278&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/Driver/darwin-header-search-libstdcxx.cpp (added)
>> +++ cfe/trunk/test/Driver/darwin-header-search-libstdcxx.cpp Tue May 21
>> 10:48:04 2019
>> @@ -0,0 +1,118 @@
>> +// General tests that the header search paths for libstdc++ detected by
>> the
>> +// driver and passed to CC1 are correct on Darwin platforms.
>> +
>> +// Check ppc and ppc64
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target ppc-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_ppc \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_ppc
>> --check-prefix=CHECK-LIBSTDCXX-PPC %s
>> +// CHECK-LIBSTDCXX-PPC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBSTDCXX-PPC: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1
>> +// CHECK-LIBSTDCXX-PPC: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/powerpc-apple-darwin10"
>> +// CHECK-LIBSTDCXX-PPC: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +// CHECK-LIBSTDCXX-PPC: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0"
>> +// CHECK-LIBSTDCXX-PPC: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/powerpc-apple-darwin10"
>> +// CHECK-LIBSTDCXX-PPC: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target ppc64-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_ppc \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_ppc
>> --check-prefix=CHECK-LIBSTDCXX-PPC64 %s
>> +// CHECK-LIBSTDCXX-PPC64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBSTDCXX-PPC64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-PPC64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/powerpc-apple-darwin10/ppc64"
>> +// CHECK-LIBSTDCXX-PPC64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +// CHECK-LIBSTDCXX-PPC64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0"
>> +// CHECK-LIBSTDCXX-PPC64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/powerpc-apple-darwin10/ppc64"
>> +// CHECK-LIBSTDCXX-PPC64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
>> +
>> +// Check x86 and x86_64
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target i686-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_x86 \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_x86
>> --check-prefix=CHECK-LIBSTDCXX-X86 %s
>> +// CHECK-LIBSTDCXX-X86: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBSTDCXX-X86: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-X86: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/i686-apple-darwin10"
>> +// CHECK-LIBSTDCXX-X86: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +// CHECK-LIBSTDCXX-X86: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0"
>> +// CHECK-LIBSTDCXX-X86: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/i686-apple-darwin8"
>> +// CHECK-LIBSTDCXX-X86: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_x86 \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_x86
>> --check-prefix=CHECK-LIBSTDCXX-X86_64 %s
>> +// CHECK-LIBSTDCXX-X86_64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBSTDCXX-X86_64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-X86_64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
>> +// CHECK-LIBSTDCXX-X86_64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +// CHECK-LIBSTDCXX-X86_64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0"
>> +// CHECK-LIBSTDCXX-X86_64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/i686-apple-darwin8"
>> +// CHECK-LIBSTDCXX-X86_64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
>> +
>> +// Check arm and thumb
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target arm-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_arm \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_arm
>> --check-prefix=CHECK-LIBSTDCXX-ARM %s
>> +// CHECK-LIBSTDCXX-ARM: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBSTDCXX-ARM: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-ARM: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v7"
>> +// CHECK-LIBSTDCXX-ARM: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +// CHECK-LIBSTDCXX-ARM: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-ARM: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v6"
>> +// CHECK-LIBSTDCXX-ARM: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target arm-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_arm \
>> +// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_arm
>> --check-prefix=CHECK-LIBSTDCXX-THUMB %s
>> +// CHECK-LIBSTDCXX-THUMB: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBSTDCXX-THUMB: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-THUMB: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v7"
>> +// CHECK-LIBSTDCXX-THUMB: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +// CHECK-LIBSTDCXX-THUMB: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-THUMB: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v6"
>> +// CHECK-LIBSTDCXX-THUMB: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +
>> +// Check aarch64
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target arm64-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_aarch64 \
>> +// RUN:   | FileCheck
>> -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_aarch64
>> --check-prefix=CHECK-LIBSTDCXX-AARCH64 %s
>> +// CHECK-LIBSTDCXX-AARCH64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-LIBSTDCXX-AARCH64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1"
>> +// CHECK-LIBSTDCXX-AARCH64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/arm64-apple-darwin10"
>> +// CHECK-LIBSTDCXX-AARCH64: "-internal-isystem"
>> "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
>> +
>> +// Make sure we issue a warning when we can't find the path
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -stdlib=libstdc++ \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
>> +// RUN:   | FileCheck --check-prefix=CHECK-LIBSTDCXX-MISSING %s
>> +// CHECK-LIBSTDCXX-MISSING: clang: warning: include path for libstdc++
>> headers not found; pass '-stdlib=libc++' on the command line to use the
>> libc++ standard library instead
>> +//
>> +// RUN: %clang %s -target x86_64-apple-darwin -fsyntax-only 2>&1 \
>> +// RUN:           -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
>> +// RUN:           -stdlib=libc++ \
>> +// RUN:    | FileCheck -allow-empty
>> --check-prefix=CHECK-LIBSTDCXX-MISSING-1 %s
>> +// CHECK-LIBSTDCXX-MISSING-1-NOT: warning
>> +//
>> +// RUN: %clang %s -target x86_64-apple-darwin -fsyntax-only 2>&1 \
>> +// RUN:           -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
>> +// RUN:    | FileCheck -allow-empty
>> --check-prefix=CHECK-LIBSTDCXX-MISSING-2 %s
>> +// CHECK-LIBSTDCXX-MISSING-2-NOT: warning
>>
>> Added: cfe/trunk/test/Driver/darwin-header-search-system.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-header-search-system.cpp?rev=361278&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/Driver/darwin-header-search-system.cpp (added)
>> +++ cfe/trunk/test/Driver/darwin-header-search-system.cpp Tue May 21
>> 10:48:04 2019
>> @@ -0,0 +1,80 @@
>> +// General tests that the system header search paths detected by the
>> driver
>> +// and passed to CC1 are correct on Darwin platforms.
>> +
>> +// Check system headers (everything below <sysroot> and <resource-dir>)
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -ccc-install-dir
>> %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:   | FileCheck
>> -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:               -DRESOURCE=%S/Inputs/resource_dir \
>> +// RUN:               --check-prefix=CHECK-SYSTEM %s
>> +// CHECK-SYSTEM: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-SYSTEM: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
>> +// CHECK-SYSTEM: "-internal-isystem" "[[RESOURCE]]/include"
>> +// CHECK-SYSTEM: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
>> +
>> +// Make sure that using -nobuiltininc will drop resource headers
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -ccc-install-dir
>> %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:     -nobuiltininc \
>> +// RUN:   | FileCheck
>> -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:               -DRESOURCE=%S/Inputs/resource_dir \
>> +// RUN:               --check-prefix=CHECK-NOBUILTININC %s
>> +// CHECK-NOBUILTININC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-NOBUILTININC: "-internal-isystem"
>> "[[SYSROOT]]/usr/local/include"
>> +// CHECK-NOBUILTININC-NOT: "-internal-isystem" "[[RESOURCE]]/include"
>> +// CHECK-NOBUILTININC: "-internal-externc-isystem"
>> "[[SYSROOT]]/usr/include"
>> +
>> +// Make sure that using -nostdlibinc will drop
>> <sysroot>/usr/local/include and
>> +// <sysroot>/usr/include.
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -ccc-install-dir
>> %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:     -nostdlibinc \
>> +// RUN:   | FileCheck
>> -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:               -DRESOURCE=%S/Inputs/resource_dir \
>> +// RUN:               --check-prefix=CHECK-NOSTDLIBINC %s
>> +// CHECK-NOSTDLIBINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-NOSTDLIBINC-NOT: "-internal-isystem"
>> "[[SYSROOT]]/usr/local/include"
>> +// CHECK-NOSTDLIBINC: "-internal-isystem" "[[RESOURCE]]/include"
>> +// CHECK-NOSTDLIBINC-NOT: "-internal-externc-isystem"
>> "[[SYSROOT]]/usr/include"
>> +
>> +// Make sure that -nostdinc drops all the system include paths, including
>> +// <resource>/include.
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -ccc-install-dir
>> %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:     -nostdinc \
>> +// RUN:   | FileCheck
>> -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
>> +// RUN:               -DRESOURCE=%S/Inputs/resource_dir \
>> +// RUN:               --check-prefix=CHECK-NOSTDINC %s
>> +// CHECK-NOSTDINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-NOSTDINC-NOT: "-internal-isystem"
>> "[[SYSROOT]]/usr/local/include"
>> +// CHECK-NOSTDINC-NOT: "-internal-isystem" "[[RESOURCE]]/include"
>> +// CHECK-NOSTDINC-NOT: "-internal-externc-isystem"
>> "[[SYSROOT]]/usr/include"
>> +
>> +// Check search paths without -isysroot
>> +//
>> +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
>> +// RUN:     -target x86_64-apple-darwin \
>> +// RUN:     -ccc-install-dir
>> %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
>> +// RUN:     -resource-dir=%S/Inputs/resource_dir \
>> +// RUN:   | FileCheck -DRESOURCE=%S/Inputs/resource_dir \
>> +// RUN:               --check-prefix=CHECK-NOSYSROOT %s
>> +// CHECK-NOSYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>> +// CHECK-NOSYSROOT: "-internal-isystem" "/usr/local/include"
>> +// CHECK-NOSYSROOT: "-internal-isystem" "[[RESOURCE]]/include"
>> +// CHECK-NOSYSROOT: "-internal-externc-isystem" "/usr/include"
>>
>> Modified: cfe/trunk/test/Driver/darwin-stdlib.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-stdlib.cpp?rev=361278&r1=361277&r2=361278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Driver/darwin-stdlib.cpp (original)
>> +++ cfe/trunk/test/Driver/darwin-stdlib.cpp Tue May 21 10:48:04 2019
>> @@ -3,19 +3,12 @@
>>  // XFAIL: default-cxx-stdlib-set
>>
>>  // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64 -miphoneos-version-min=7.0
>> %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
>> -// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.8 %s -### 2>&1
>> | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
>> +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.8
>> -Wno-stdlibcxx-not-found %s -### 2>&1 | FileCheck %s
>> --check-prefix=CHECK-LIBSTDCXX
>>  // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.9 %s -### 2>&1
>> | FileCheck %s --check-prefix=CHECK-LIBCXX
>> -// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s
>> -miphoneos-version-min=6.1 %s -### 2>&1 | FileCheck %s
>> --check-prefix=CHECK-LIBSTDCXX
>> +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s
>> -miphoneos-version-min=6.1 -Wno-stdlibcxx-not-found %s -### 2>&1 |
>> FileCheck %s --check-prefix=CHECK-LIBSTDCXX
>>  // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s
>> -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s
>> --check-prefix=CHECK-LIBCXX
>>  // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir
>> %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k %s -### 2>&1 | FileCheck
>> %s --check-prefix=CHECK-LIBCXX
>>
>> -// The purpose of this test is that the libc++ headers should be found
>> -// properly. We also pass -stdlib=libc++ to make sure the logic to add
>> the
>> -// optional absolute include for libc++ from InitHeaderSearch.cpp also
>> fires.
>> -
>>  // CHECK-LIBCXX: "-stdlib=libc++"
>> -// CHECK-LIBCXX: "-internal-isystem"
>> "{{[^"]*}}{{/|\\\\}}Inputs{{/|\\\\}}darwin_toolchain_tree{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
>> -
>>  // CHECK-LIBSTDCXX-NOT: -stdlib=libc++
>>  // CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++
>> -// CHECK-LIBSTDCXX-NOT: -internal-isystem
>>
>> Removed: cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp?rev=361277&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp (original)
>> +++ cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp (removed)
>> @@ -1,6 +0,0 @@
>> -// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot
>> %S/doesnotexist %s 2>&1 | FileCheck %s
>> -// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot
>> %S/doesnotexist -stdlib=libc++ %s -verify
>> -// RUN: %clang -cc1 -x c++-cpp-output -triple arm64-apple-ios6.0.0
>> -isysroot %S/doesnotexist %s -verify
>> -// CHECK: include path for stdlibc++ headers not found; pass
>> '-stdlib=libc++' on the command line to use the libc++ standard library
>> instead
>> -
>> -// expected-no-diagnostics
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190521/7616beab/attachment-0001.html>


More information about the cfe-commits mailing list