r220547 - Driver: add missed file from previous commit

Reid Kleckner rnk at google.com
Fri Oct 24 11:19:25 PDT 2014


On Thu, Oct 23, 2014 at 8:24 PM, Saleem Abdulrasool
<compnerd at compnerd.org> wrote:
> +void CrossWindowsToolChain::
> +AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
> +                             llvm::opt::ArgStringList &CC1Args) const {
> +  const llvm::Triple &Triple = getTriple();
> +  const std::string &SysRoot = getDriver().SysRoot;
> +
> +  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
> +      DriverArgs.hasArg(options::OPT_nostdincxx))
> +    return;
> +
> +  switch (GetCXXStdlibType(DriverArgs)) {
> +  case ToolChain::CST_Libcxx:
> +    addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include/c++/v1");
> +    break;
> +
> +  case ToolChain::CST_Libstdcxx:
> +    addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/incldue/c++");
> +    switch (Triple.getArch()) {
> +    default: llvm_unreachable("unsupported architecture");

It shouldn't be this easy for users to trip assertions or hit
unreachable code. I think adding /usr/include/c++/Triple to the
include search path, and letting users debug any fallout from that is
probably reasonable.

> +    case llvm::Triple::x86:
> +    case llvm::Triple::x86_64:
> +      addSystemInclude(DriverArgs, CC1Args,
> +                       SysRoot + "/usr/include/c++/" + Triple.str());
> +      break;
> +    }
> +    addSystemInclude(DriverArgs, CC1Args,
> +                     SysRoot + "/usr/include/c++/backwards");
> +  }
> +}



More information about the cfe-commits mailing list