@@ -1889,7 +1889,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
18891889
18901890void CompilerInvocation::setLangDefaults (LangOptions &Opts, InputKind IK,
18911891 const llvm::Triple &T,
1892- PreprocessorOptions &PPOpts ,
1892+ std::vector<std::string> &Includes ,
18931893 LangStandard::Kind LangStd) {
18941894 // Set some properties which depend solely on the input kind; it would be nice
18951895 // to move these to the language standard, and have the driver resolve the
@@ -2000,9 +2000,9 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
20002000 if (Opts.IncludeDefaultHeader ) {
20012001 if (Opts.DeclareOpenCLBuiltins ) {
20022002 // Only include base header file for builtin types and constants.
2003- PPOpts. Includes .push_back (" opencl-c-base.h" );
2003+ Includes.push_back (" opencl-c-base.h" );
20042004 } else {
2005- PPOpts. Includes .push_back (" opencl-c.h" );
2005+ Includes.push_back (" opencl-c.h" );
20062006 }
20072007 }
20082008 }
@@ -2138,8 +2138,8 @@ static const StringRef GetInputKindName(InputKind IK) {
21382138}
21392139
21402140static void ParseLangArgs (LangOptions &Opts, ArgList &Args, InputKind IK,
2141- const TargetOptions &TargetOpts ,
2142- PreprocessorOptions &PPOpts ,
2141+ const llvm::Triple &T ,
2142+ std::vector<std::string> &Includes ,
21432143 DiagnosticsEngine &Diags) {
21442144 // FIXME: Cleanup per-file based stuff.
21452145 LangStandard::Kind LangStd = LangStandard::lang_unspecified;
@@ -2212,8 +2212,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
22122212
22132213 Opts.SYCLIsDevice = Opts.SYCL && Args.hasArg (options::OPT_fsycl_is_device);
22142214
2215- llvm::Triple T (TargetOpts.Triple );
2216- CompilerInvocation::setLangDefaults (Opts, IK, T, PPOpts, LangStd);
2215+ CompilerInvocation::setLangDefaults (Opts, IK, T, Includes, LangStd);
22172216
22182217 // -cl-strict-aliasing needs to emit diagnostic in the case where CL > 1.0.
22192218 // This option should be deprecated for CL > 1.0 because
@@ -2490,7 +2489,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
24902489 Diags.Report (diag::err_drv_argument_not_allowed_with)
24912490 << A->getSpelling () << " -fdefault-calling-conv" ;
24922491 else {
2493- llvm::Triple T (TargetOpts.Triple );
24942492 if (T.getArch () != llvm::Triple::x86)
24952493 Diags.Report (diag::err_drv_argument_not_allowed_with)
24962494 << A->getSpelling () << T.getTriple ();
@@ -2527,8 +2525,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
25272525 // Add unsupported host targets here:
25282526 case llvm::Triple::nvptx:
25292527 case llvm::Triple::nvptx64:
2530- Diags.Report (diag::err_drv_omp_host_target_not_supported)
2531- << TargetOpts.Triple ;
2528+ Diags.Report (diag::err_drv_omp_host_target_not_supported) << T.str ();
25322529 break ;
25332530 }
25342531 }
@@ -2960,8 +2957,8 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
29602957 } else {
29612958 // Other LangOpts are only initialized when the input is not AST or LLVM IR.
29622959 // FIXME: Should we really be calling this for an Language::Asm input?
2963- ParseLangArgs (LangOpts, Args, DashX, Res.getTargetOpts () ,
2964- Res. getPreprocessorOpts (), Diags);
2960+ ParseLangArgs (LangOpts, Args, DashX, T, Res.getPreprocessorOpts (). Includes ,
2961+ Diags);
29652962 if (Res.getFrontendOpts ().ProgramAction == frontend::RewriteObjC)
29662963 LangOpts.ObjCExceptions = 1 ;
29672964 if (T.isOSDarwin () && DashX.isPreprocessed ()) {
0 commit comments