Hi Richard,
I posted https://reviews.llvm.org/D22518, is this more or less what you intended?
Thanks,
Samuel
----- Original message -----
From: Richard Smith <rich...@metafoo.co.uk>
Sent by: meta...@gmail.com
To: Samuel F Antao/Watson/IBM@IBMUS
Cc: cfe-commits <cfe-commits@lists.llvm.org>
Subject: Re: r275931 - Append clang system include path for offloading tool chains.
Date: Mon, Jul 18, 2016 8:29 PM
On Mon, Jul 18, 2016 at 5:01 PM, Samuel Antao via cfe-commits <cfe-commits@lists.llvm.org> wrote:Author: sfantao
Date: Mon Jul 18 19:01:12 2016
New Revision: 275931
URL: http://llvm.org/viewvc/llvm-project?rev=275931&view=rev
Log:
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
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=275931&r1=275930&r2=275931&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jul 18 19:01:12 2016
@@ -314,6 +314,24 @@ static void addExtraOffloadCXXStdlibIncl
// 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);We now have three copies of this code to get an aux toolchain, and we have three copies of code that calls the same function on the current toolchain and optionally on an offloading toolchain. Can we do something about this redundancy? Can we replace this duplication with something like:forRegularAndOffloadToolchains(C, JA, [&](ToolChain &TC) {TC.AddClangSystemIncludeArgs(Args, CmdLine);});?+
+ // 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(Comp
// 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);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits