@@ -520,21 +520,44 @@ importer::getNormalInvocationArguments(
520
520
invocationArgStrs.push_back (
521
521
" -Werror=non-modular-include-in-framework-module" );
522
522
523
+ bool EnableCXXInterop = LangOpts.EnableCXXInterop ;
524
+
523
525
if (LangOpts.EnableObjCInterop ) {
524
- bool EnableCXXInterop = LangOpts.EnableCXXInterop ;
525
- invocationArgStrs.insert (
526
- invocationArgStrs.end (),
527
- {" -x" , EnableCXXInterop ? " objective-c++" : " objective-c" ,
528
- EnableCXXInterop ? " -std=gnu++17" : " -std=gnu11" , " -fobjc-arc" });
526
+ invocationArgStrs.insert (invocationArgStrs.end (), {" -fobjc-arc" });
529
527
// TODO: Investigate whether 7.0 is a suitable default version.
530
528
if (!triple.isOSDarwin ())
531
529
invocationArgStrs.insert (invocationArgStrs.end (),
532
530
{" -fobjc-runtime=ios-7.0" });
531
+ invocationArgStrs.insert (invocationArgStrs.end (), {
532
+ " -x" , EnableCXXInterop ? " objective-c++" : " objective-c"
533
+ });
533
534
} else {
534
- bool EnableCXXInterop = LangOpts.EnableCXXInterop ;
535
- invocationArgStrs.insert (invocationArgStrs.end (),
536
- {" -x" , EnableCXXInterop ? " c++" : " c" ,
537
- EnableCXXInterop ? " -std=gnu++17" : " -std=gnu11" });
535
+ invocationArgStrs.insert (invocationArgStrs.end (), {
536
+ " -x" , EnableCXXInterop ? " c++" : " c"
537
+ });
538
+ }
539
+
540
+ {
541
+ const clang::LangStandard &stdcxx =
542
+ #if defined(CLANG_DEFAULT_STD_CXX)
543
+ *clang::LangStandard::getLangStandardForName (CLANG_DEFAULT_STD_CXX);
544
+ #else
545
+ clang::LangStandard::getLangStandardForKind (
546
+ clang::LangStandard::lang_gnucxx14);
547
+ #endif
548
+
549
+ const clang::LangStandard &stdc =
550
+ #if defined(CLANG_DEFAULT_STD_C)
551
+ *clang::LangStandard::getLangStandardForName (CLANG_DEFAULT_STD_C);
552
+ #else
553
+ clang::LangStandard::getLangStandardForKind (
554
+ clang::LangStandard::lang_gnu11);
555
+ #endif
556
+
557
+ invocationArgStrs.insert (invocationArgStrs.end (), {
558
+ (Twine (" -std=" ) + StringRef (EnableCXXInterop ? stdcxx.getName ()
559
+ : stdc.getName ())).str ()
560
+ });
538
561
}
539
562
540
563
// Set C language options.
0 commit comments