diff options
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 3c593fc..5df8efaf 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -278,7 +278,8 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA, const Driver &D, const ArgList &Args, ArgStringList &CmdArgs, const InputInfo &Output, - const InputInfoList &Inputs) const { + const InputInfoList &Inputs, + const ToolChain *AuxToolChain) const { Arg *A; CheckPreprocessingOptions(D, Args); @@ -470,12 +471,26 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA, // OBJCPLUS_INCLUDE_PATH - system includes enabled when compiling ObjC++. addDirectoryList(Args, CmdArgs, "-objcxx-isystem", "OBJCPLUS_INCLUDE_PATH"); + // Optional AuxToolChain indicates that we need to include headers + // for more than one target. If that's the case, add include paths + // from AuxToolChain right after include paths of the same kind for + // the current target. + // Add C++ include arguments, if needed. - if (types::isCXX(Inputs[0].getType())) + if (types::isCXX(Inputs[0].getType())) { getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs); + if (AuxToolChain) + AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs); + } // Add system include arguments. getToolChain().AddClangSystemIncludeArgs(Args, CmdArgs); + if (AuxToolChain) + AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs); + + // Add CUDA include arguments, if needed. + if (types::isCuda(Inputs[0].getType())) + getToolChain().AddCudaIncludeArgs(Args, CmdArgs); } // FIXME: Move to target hook. @@ -3262,12 +3277,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-triple"); CmdArgs.push_back(Args.MakeArgString(TripleStr)); + const ToolChain *AuxToolChain = nullptr; if (IsCuda) { // FIXME: We need a (better) way to pass information about // particular compilation pass we're constructing here. For now we // can check which toolchain we're using and pick the other one to // extract the triple. - const ToolChain *AuxToolChain; if (&getToolChain() == C.getCudaDeviceToolChain()) AuxToolChain = C.getCudaHostToolChain(); else if (&getToolChain() == C.getCudaHostToolChain()) @@ -4085,7 +4100,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // // FIXME: Support -fpreprocessed if (types::getPreprocessedType(InputType) != types::TY_INVALID) - AddPreprocessingOptions(C, JA, D, Args, CmdArgs, Output, Inputs); + AddPreprocessingOptions(C, JA, D, Args, CmdArgs, Output, Inputs, + AuxToolChain); // Don't warn about "clang -c -DPIC -fPIC test.i" because libtool.m4 assumes // that "The compiler can only warn and ignore the option if not recognized". |