@@ -6769,14 +6769,26 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
6769
6769
bool *EmitCodeView) const {
6770
6770
unsigned RTOptionID = options::OPT__SLASH_MT;
6771
6771
bool isNVPTX = getToolChain ().getTriple ().isNVPTX ();
6772
+ bool isSYCL =
6773
+ Args.hasArg (options::OPT_fsycl) ||
6774
+ getToolChain ().getTriple ().getEnvironment () == llvm::Triple::SYCLDevice;
6775
+ // For SYCL Windows, /MD is the default.
6776
+ if (isSYCL)
6777
+ RTOptionID = options::OPT__SLASH_MD;
6772
6778
6773
6779
if (Args.hasArg (options::OPT__SLASH_LDd))
6774
- // The /LDd option implies /MTd. The dependent lib part can be overridden,
6775
- // but defining _DEBUG is sticky.
6776
- RTOptionID = options::OPT__SLASH_MTd;
6780
+ // The /LDd option implies /MTd (/MDd for SYCL) . The dependent lib part
6781
+ // can be overridden but defining _DEBUG is sticky.
6782
+ RTOptionID = isSYCL ? options::OPT__SLASH_MDd : options::OPT__SLASH_MTd;
6777
6783
6778
- if (Arg *A = Args.getLastArg (options::OPT__SLASH_M_Group))
6784
+ if (Arg *A = Args.getLastArg (options::OPT__SLASH_M_Group)) {
6779
6785
RTOptionID = A->getOption ().getID ();
6786
+ if (isSYCL && (RTOptionID == options::OPT__SLASH_MT ||
6787
+ RTOptionID == options::OPT__SLASH_MTd))
6788
+ // Use of /MT or /MTd is not supported for SYCL.
6789
+ getToolChain ().getDriver ().Diag (diag::err_drv_unsupported_opt_dpcpp)
6790
+ << A->getOption ().getName ();
6791
+ }
6780
6792
6781
6793
StringRef FlagForCRT;
6782
6794
switch (RTOptionID) {
0 commit comments