@@ -239,7 +239,9 @@ elif platform.system() == 'Darwin':
239239config .substitutions .append ( ('%lto_flags' , lto_flags ) )
240240config .substitutions .append ( ('%use_just_built_liblto' , use_just_built_liblto ) )
241241config .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 ) )
243245
244246# Allow tests to restore the original environment if they need to.
245247config .substitutions .append ( ('%original_path_env' , config .environment ['PATH' ]) )
@@ -395,28 +397,6 @@ lit_config.note('Using resource dir: ' + test_resource_dir)
395397test_clang_resource_dir = lit .util .executeCommand ([config .clang , '-print-resource-dir' ])[0 ].rstrip ()
396398lit_config .note ('Using Clang resource dir: ' + test_clang_resource_dir )
397399
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-
420400# Parse the variant triple.
421401# FIXME: We ought to parse 'run_environment' separately from 'run_os'.
422402(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:
479459 lit_config .note ('Using SDK overlay dir: ' + test_sdk_overlay_dir )
480460 config .resource_dir_opt += (" %s" % sdk_overlay_dir_opt )
481461
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+
482484# Default to Swift 4 for now.
483485# Note that this accepts both `--param swift-version` (like the compiler flag)
484486# and `--param swift_version` (like a lit configuration parameter).
@@ -1944,6 +1946,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
19441946 config .target_swift_symbolgraph_extract = ' ' .join ([
19451947 config .swift_symbolgraph_extract ,
19461948 '-target' , config .variant_triple ,
1949+ '-sdk' , config .variant_sdk , config .resource_dir_opt ,
19471950 mcp_opt ])
19481951 config .target_swift_synthesize_interface = ' ' .join ([
19491952 config .swift_synthesize_interface ,
@@ -2747,6 +2750,7 @@ config.substitutions.insert(0, ('%check-c-header-in-clang',
27472750# Verifies that a C++ file can be compiled without warnings except for some exceptions.
27482751config .substitutions .insert (0 , ('%check-cxx-header-in-clang' ,
27492752 '%clangxx -fsyntax-only -x c++-header ' + extraCheckWarningFlags +
2753+ ' --sysroot %r ' % config .variant_sdk +
27502754 # Use standard header/framework search paths.
27512755 '-F %%clang-importer-sdk-path/frameworks '
27522756 '-I %%clang-include-dir %%cxx-stdlib-include '
0 commit comments