summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-08-15 20:38:52 +0000
committerJustin Lebar <jlebar@google.com>2016-08-15 20:38:52 +0000
commit9421ba6c024151a2be99ccb58f657d09189e2464 (patch)
tree95094053380542b20ee7b33a77d3ebea7e13c882 /clang/lib
parenta27654a7931bb31f555edb97b7c1d856d97678e8 (diff)
downloadbcm5719-llvm-9421ba6c024151a2be99ccb58f657d09189e2464.tar.gz
bcm5719-llvm-9421ba6c024151a2be99ccb58f657d09189e2464.zip
[CUDA] Include CUDA headers before anything else.
Summary: There's no point to --cuda-path if we then go and include /usr/include first. And if you install the right packages, Ubuntu will install (very old) CUDA headers there. Reviewers: tra Subscribers: cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D23341 llvm-svn: 278734
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Tools.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 0efda4858f1..4900e20c484 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -410,6 +410,13 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
}
}
+ // Add offload include arguments specific for CUDA. This must happen before
+ // we -I or -include anything else, because we must pick up the CUDA headers
+ // from the particular CUDA installation, rather than from e.g.
+ // /usr/local/include.
+ if (JA.isOffloading(Action::OFK_Cuda))
+ getToolChain().AddCudaIncludeArgs(Args, CmdArgs);
+
// Add -i* options, and automatically translate to
// -include-pch/-include-pth for transparent PCH support. It's
// wonky, but we include looking for .gch so we can support seamless
@@ -607,10 +614,6 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
// For IAMCU add special include arguments.
getToolChain().AddIAMCUIncludeArgs(Args, CmdArgs);
}
-
- // Add offload include arguments specific for CUDA if that is required.
- if (JA.isOffloading(Action::OFK_Cuda))
- getToolChain().AddCudaIncludeArgs(Args, CmdArgs);
}
// FIXME: Move to target hook.
OpenPOWER on IntegriCloud