@@ -239,7 +239,9 @@ elif platform.system() == 'Darwin':
239
239
config .substitutions .append ( ('%lto_flags' , lto_flags ) )
240
240
config .substitutions .append ( ('%use_just_built_liblto' , use_just_built_liblto ) )
241
241
config .substitutions .append ( ('%llvm_libs_dir' , llvm_libs_dir ) )
242
- config .substitutions .append ( ('%llvm_plugin_ext' , llvm_plugin_ext ) )
242
+
243
+ if llvm_plugin_ext is not None :
244
+ config .substitutions .append ( ('%llvm_plugin_ext' , llvm_plugin_ext ) )
243
245
244
246
# Allow tests to restore the original environment if they need to.
245
247
config .substitutions .append ( ('%original_path_env' , config .environment ['PATH' ]) )
@@ -395,28 +397,6 @@ lit_config.note('Using resource dir: ' + test_resource_dir)
395
397
test_clang_resource_dir = lit .util .executeCommand ([config .clang , '-print-resource-dir' ])[0 ].rstrip ()
396
398
lit_config .note ('Using Clang resource dir: ' + test_clang_resource_dir )
397
399
398
- config .swift_system_overlay_opt = ""
399
- config .clang_system_overlay_opt = ""
400
- config .windows_vfs_overlay_opt = ""
401
- if kIsWindows :
402
- # ucrt.modulemap currently requires -fbuiltin-headers-in-system-modules. -strict-implicit-module-context
403
- # is necessary for -Xcc arguments to be passed through ModuleInterfaceLoader.
404
- config .swift_system_overlay_opt = "-vfsoverlay {} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" .format (
405
- os .path .join (config .swift_obj_root , "stdlib" , "windows-vfs-overlay.yaml" )
406
- )
407
- # this variant is for extract-symbolgraph which doesn't accept all the same arugments as swiftc
408
- # so the extra ceremony lets us pass in the relevant pieces needed for Windows SDK access.
409
- config .windows_vfs_overlay_opt = "-Xcc -vfsoverlay -Xcc {} -Xcc -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" .format (
410
- os .path .join (config .swift_obj_root , "stdlib" , "windows-vfs-overlay.yaml" )
411
- )
412
- config .clang_system_overlay_opt = "-Xcc -ivfsoverlay -Xcc {} -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" .format (
413
- os .path .join (config .swift_obj_root , "stdlib" , "windows-vfs-overlay.yaml" )
414
- )
415
- config .substitutions .append ( ('%windows_vfs_overlay_opt' , config .windows_vfs_overlay_opt ) )
416
- stdlib_resource_dir_opt = config .resource_dir_opt
417
- sourcekitd_framework_dir = config .swift_lib_dir
418
- config .substitutions .append ( ('%test-resource-dir' , test_resource_dir ) )
419
-
420
400
# Parse the variant triple.
421
401
# FIXME: We ought to parse 'run_environment' separately from 'run_os'.
422
402
(run_cpu , run_vendor , run_os , run_vers ) = re .match ('([^-]+)-([^-]+)-([^0-9]+)(.*)' , config .variant_triple ).groups ()
@@ -479,6 +459,28 @@ if test_sdk_overlay_dir is not None:
479
459
lit_config .note ('Using SDK overlay dir: ' + test_sdk_overlay_dir )
480
460
config .resource_dir_opt += (" %s" % sdk_overlay_dir_opt )
481
461
462
+ config .swift_system_overlay_opt = ""
463
+ config .clang_system_overlay_opt = ""
464
+ config .windows_vfs_overlay_opt = ""
465
+ if kIsWindows and run_os in ['windows-msvc' ]:
466
+ # ucrt.modulemap currently requires -fbuiltin-headers-in-system-modules. -strict-implicit-module-context
467
+ # is necessary for -Xcc arguments to be passed through ModuleInterfaceLoader.
468
+ config .swift_system_overlay_opt = "-vfsoverlay {} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" .format (
469
+ os .path .join (config .swift_obj_root , "stdlib" , "windows-vfs-overlay.yaml" )
470
+ )
471
+ # this variant is for extract-symbolgraph which doesn't accept all the same arugments as swiftc
472
+ # so the extra ceremony lets us pass in the relevant pieces needed for Windows SDK access.
473
+ config .windows_vfs_overlay_opt = "-Xcc -vfsoverlay -Xcc {} -Xcc -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" .format (
474
+ os .path .join (config .swift_obj_root , "stdlib" , "windows-vfs-overlay.yaml" )
475
+ )
476
+ config .clang_system_overlay_opt = "-Xcc -ivfsoverlay -Xcc {} -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" .format (
477
+ os .path .join (config .swift_obj_root , "stdlib" , "windows-vfs-overlay.yaml" )
478
+ )
479
+ config .substitutions .append ( ('%windows_vfs_overlay_opt' , config .windows_vfs_overlay_opt ) )
480
+ stdlib_resource_dir_opt = config .resource_dir_opt
481
+ sourcekitd_framework_dir = config .swift_lib_dir
482
+ config .substitutions .append ( ('%test-resource-dir' , test_resource_dir ) )
483
+
482
484
# Default to Swift 4 for now.
483
485
# Note that this accepts both `--param swift-version` (like the compiler flag)
484
486
# and `--param swift_version` (like a lit configuration parameter).
@@ -1944,6 +1946,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
1944
1946
config .target_swift_symbolgraph_extract = ' ' .join ([
1945
1947
config .swift_symbolgraph_extract ,
1946
1948
'-target' , config .variant_triple ,
1949
+ '-sdk' , config .variant_sdk , config .resource_dir_opt ,
1947
1950
mcp_opt ])
1948
1951
config .target_swift_synthesize_interface = ' ' .join ([
1949
1952
config .swift_synthesize_interface ,
@@ -2747,6 +2750,7 @@ config.substitutions.insert(0, ('%check-c-header-in-clang',
2747
2750
# Verifies that a C++ file can be compiled without warnings except for some exceptions.
2748
2751
config .substitutions .insert (0 , ('%check-cxx-header-in-clang' ,
2749
2752
'%clangxx -fsyntax-only -x c++-header ' + extraCheckWarningFlags +
2753
+ ' --sysroot %r ' % config .variant_sdk +
2750
2754
# Use standard header/framework search paths.
2751
2755
'-F %%clang-importer-sdk-path/frameworks '
2752
2756
'-I %%clang-include-dir %%cxx-stdlib-include '
0 commit comments