-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL] Enable programs that include system headers on Windows #325
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 |
---|---|---|
|
@@ -3550,14 +3550,30 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, | |
|
||
if (UseSYCLTriple) { | ||
// We want to compile sycl kernels. | ||
if (types::isCXX(Input.getType())) | ||
CmdArgs.push_back("-std=c++11"); | ||
CmdArgs.push_back("-fsycl-is-device"); | ||
// Pass the triple of host when doing SYCL | ||
std::string NormalizedTriple = | ||
llvm::Triple(llvm::sys::getProcessTriple()).normalize(); | ||
auto AuxT = llvm::Triple(llvm::sys::getProcessTriple()); | ||
std::string NormalizedTriple = AuxT.normalize(); | ||
CmdArgs.push_back("-aux-triple"); | ||
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple)); | ||
|
||
bool IsMSVC = AuxT.isWindowsMSVCEnvironment(); | ||
if (types::isCXX(Input.getType())) | ||
CmdArgs.push_back(IsMSVC ? "-std=c++14" : "-std=c++11"); | ||
if (IsMSVC) { | ||
CmdArgs.push_back("-fms-extensions"); | ||
VersionTuple MSVT = TC.computeMSVCVersion(&D, Args); | ||
if (!MSVT.empty()) | ||
CmdArgs.push_back(Args.MakeArgString("-fms-compatibility-version=" + | ||
MSVT.getAsString())); | ||
else { | ||
const char *LowestMSVCSupported = | ||
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. Why is this 2 lines? 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. because clang-format 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. Sorry, I mean, why is LowestMSVCSupported a separate variable instead of just being a constant in the line below? 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 thought it was nicer this way, self documenting and all |
||
"191025017"; // VS2017 v15.0 (initial release) | ||
CmdArgs.push_back(Args.MakeArgString( | ||
Twine("-fms-compatibility-version=") + LowestMSVCSupported)); | ||
} | ||
} | ||
|
||
CmdArgs.push_back("-disable-llvm-passes"); | ||
if (Args.hasFlag(options::OPT_fsycl_allow_func_ptr, | ||
options::OPT_fno_sycl_allow_func_ptr, false)) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// RUN: %clang_cc1 -triple spir64-unknown-windows-sycldevice -fsycl-is-device -aux-triple x86_64-pc-windows-msvc -fsyntax-only -verify %s | ||
bader marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// expected-no-diagnostics | ||
|
||
void foo(__builtin_va_list bvl) { | ||
char * VaList = bvl; | ||
static_assert(sizeof(wchar_t) == 2, "sizeof wchar is 2 on Windows"); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.