[PATCH] D26776: [CUDA] Initialize our header search using the host triple.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 17 16:51:19 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287286: [CUDA] Initialize our header search using the host triple. (authored by jlebar).
Changed prior to commit:
https://reviews.llvm.org/D26776?vs=78290&id=78436#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26776
Files:
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/test/Preprocessor/cuda-macos-includes.cu
Index: cfe/trunk/test/Preprocessor/cuda-macos-includes.cu
===================================================================
--- cfe/trunk/test/Preprocessor/cuda-macos-includes.cu
+++ cfe/trunk/test/Preprocessor/cuda-macos-includes.cu
@@ -0,0 +1,13 @@
+// RUN: %clang -cc1 -fcuda-is-device -isysroot /var/empty \
+// RUN: -triple nvptx-nvidia-cuda -aux-triple i386-apple-macosx \
+// RUN: -S -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
+
+// RUN: %clang -cc1 -isysroot /var/empty \
+// RUN: -triple i386-apple-macosx -aux-triple nvptx-nvidia-cuda \
+// RUN: -S -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
+
+// Check that when we do CUDA host and device compiles on MacOS, we check for
+// includes in /System/Library/Frameworks and /Library/Frameworks.
+
+// CHECK-DAG: ignoring nonexistent directory "/var/empty/System/Library/Frameworks"
+// CHECK-DAG: ignoring nonexistent directory "/var/empty/Library/Frameworks"
Index: cfe/trunk/lib/Frontend/CompilerInstance.cpp
===================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp
@@ -334,9 +334,16 @@
InitializePreprocessor(*PP, PPOpts, getPCHContainerReader(),
getFrontendOpts());
- // Initialize the header search object.
+ // Initialize the header search object. In CUDA compilations, we use the aux
+ // triple (the host triple) to initialize our header search, since we need to
+ // find the host headers in order to compile the CUDA code.
+ const llvm::Triple *HeaderSearchTriple = &PP->getTargetInfo().getTriple();
+ if (PP->getTargetInfo().getTriple().getOS() == llvm::Triple::CUDA &&
+ PP->getAuxTargetInfo())
+ HeaderSearchTriple = &PP->getAuxTargetInfo()->getTriple();
+
ApplyHeaderSearchOptions(PP->getHeaderSearchInfo(), getHeaderSearchOpts(),
- PP->getLangOpts(), PP->getTargetInfo().getTriple());
+ PP->getLangOpts(), *HeaderSearchTriple);
PP->setPreprocessedOutput(getPreprocessorOutputOpts().ShowCPP);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26776.78436.patch
Type: text/x-patch
Size: 2130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161118/a1eb0de9/attachment.bin>
More information about the cfe-commits
mailing list