diff options
| author | Samuel Antao <sfantao@us.ibm.com> | 2016-07-19 00:01:12 +0000 |
|---|---|---|
| committer | Samuel Antao <sfantao@us.ibm.com> | 2016-07-19 00:01:12 +0000 |
| commit | b10183824452369e7766137716cf847b63af38cf (patch) | |
| tree | bcb5212262a9315c7106c28cc3ec7ca9822496eb | |
| parent | dab51bbd485c98702ed7b316ae1a70e303500968 (diff) | |
| download | bcm5719-llvm-b10183824452369e7766137716cf847b63af38cf.tar.gz bcm5719-llvm-b10183824452369e7766137716cf847b63af38cf.zip | |
Append clang system include path for offloading tool chains.
Summary:
This patch adds clang system include path when offloading tool chains, e.g. CUDA, are used in the current compilation.
This fixes an issue detected by @rsmith in response to r275645.
Reviewers: rsmith, tra
Subscribers: rsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D22490
llvm-svn: 275931
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 5bea22d7714..1c9527d67c0 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -314,6 +314,24 @@ static void addExtraOffloadCXXStdlibIncludeArgs(Compilation &C, // TODO: Add support for other programming models here. } +/// Add the C include args of other offloading toolchains. If this is a host +/// job, the device toolchains are added. If this is a device job, the host +/// toolchains will be added. +static void addExtraOffloadClangSystemIncludeArgs(Compilation &C, + const JobAction &JA, + const ArgList &Args, + ArgStringList &CmdArgs) { + + if (JA.isHostOffloading(Action::OFK_Cuda)) + C.getSingleOffloadToolChain<Action::OFK_Cuda>()->AddClangSystemIncludeArgs( + Args, CmdArgs); + else if (JA.isDeviceOffloading(Action::OFK_Cuda)) + C.getSingleOffloadToolChain<Action::OFK_Host>()->AddClangSystemIncludeArgs( + Args, CmdArgs); + + // TODO: Add support for other programming models here. +} + /// Add the include args that are specific of each offloading programming model. static void addExtraOffloadSpecificIncludeArgs(Compilation &C, const JobAction &JA, @@ -612,7 +630,7 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA, // Add system include arguments for all targets but IAMCU. if (!IsIAMCU) { getToolChain().AddClangSystemIncludeArgs(Args, CmdArgs); - addExtraOffloadCXXStdlibIncludeArgs(C, JA, Args, CmdArgs); + addExtraOffloadClangSystemIncludeArgs(C, JA, Args, CmdArgs); } else { // For IAMCU add special include arguments. getToolChain().AddIAMCUIncludeArgs(Args, CmdArgs); |

