-
Notifications
You must be signed in to change notification settings - Fork 795
[clang][Driver][SYCL] Disable SYCL header search paths under -nostd[lib]inc
#20583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5045,24 +5045,27 @@ void Clang::ConstructHostCompilerJob(Compilation &C, const JobAction &JA, | |
| if (IsMSVCHostCompiler) | ||
| HostCompileArgs.push_back("/external:W0"); | ||
|
|
||
| // Add default header search directories. | ||
| SmallString<128> BaseDir(C.getDriver().Dir); | ||
| llvm::sys::path::append(BaseDir, "..", "include"); | ||
| SmallString<128> SYCLDir(BaseDir); | ||
| llvm::sys::path::append(SYCLDir, "sycl"); | ||
| // This is used to provide our wrappers around STL headers that provide | ||
| // additional functions/template specializations when the user includes those | ||
| // STL headers in their programs (e.g., <complex>). | ||
| SmallString<128> STLWrappersDir(SYCLDir); | ||
| llvm::sys::path::append(STLWrappersDir, "stl_wrappers"); | ||
| // Add the SYCL specific header directories as system directories for non | ||
| // MSVC compilers. | ||
| HostCompileArgs.push_back(IsMSVCHostCompiler ? "/external:I" : "-isystem"); | ||
| HostCompileArgs.push_back(TCArgs.MakeArgString(SYCLDir)); | ||
| HostCompileArgs.push_back(IsMSVCHostCompiler ? "/external:I" : "-isystem"); | ||
| HostCompileArgs.push_back(TCArgs.MakeArgString(STLWrappersDir)); | ||
| HostCompileArgs.push_back(IsMSVCHostCompiler ? "/external:I" : "-isystem"); | ||
| HostCompileArgs.push_back(TCArgs.MakeArgString(BaseDir)); | ||
| namespace options = clang::driver::options; | ||
| if (!TCArgs.hasArg(options::OPT_nostdlibinc, options::OPT_nostdinc)) { | ||
| // Add default header search directories. | ||
| SmallString<128> BaseDir(C.getDriver().Dir); | ||
| llvm::sys::path::append(BaseDir, "..", "include"); | ||
| SmallString<128> SYCLDir(BaseDir); | ||
| llvm::sys::path::append(SYCLDir, "sycl"); | ||
| // This is used to provide our wrappers around STL headers that provide | ||
| // additional functions/template specializations when the user includes | ||
| // those STL headers in their programs (e.g., <complex>). | ||
| SmallString<128> STLWrappersDir(SYCLDir); | ||
| llvm::sys::path::append(STLWrappersDir, "stl_wrappers"); | ||
| // Add the SYCL specific header directories as system directories for non | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand that you have retained the comments from the original code, but could you add some context on why SYCL specific header directories are added as system directories for non MSVC compilers?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That should go into a separate PR, possibly merging the implementation of host/device toolchains. |
||
| // MSVC compilers. | ||
| HostCompileArgs.push_back(IsMSVCHostCompiler ? "/external:I" : "-isystem"); | ||
| HostCompileArgs.push_back(TCArgs.MakeArgString(SYCLDir)); | ||
| HostCompileArgs.push_back(IsMSVCHostCompiler ? "/external:I" : "-isystem"); | ||
| HostCompileArgs.push_back(TCArgs.MakeArgString(STLWrappersDir)); | ||
| HostCompileArgs.push_back(IsMSVCHostCompiler ? "/external:I" : "-isystem"); | ||
| HostCompileArgs.push_back(TCArgs.MakeArgString(BaseDir)); | ||
| } | ||
|
|
||
| if (!OutputAdded) { | ||
| // Add output file to the command line. This is assumed to be prefaced | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // RUN: %clangxx -fsycl -fsycl-device-only -nostdlibinc -fsyntax-only %s | ||
srividya-sundaram marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // RUN: %clangxx -fsycl -fsycl-device-only -nostdinc -fsyntax-only %s | ||
|
|
||
| // RUN: %clangxx -fsycl -nostdlibinc -fsyntax-only %s | ||
| // RUN: %clangxx -fsycl -nostdinc -fsyntax-only %s | ||
|
|
||
| #if __has_include(<sycl/sycl.hpp>) | ||
| #error "expected to *not* be able to find SYCL headers" | ||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.