This adds the following four new options:
- `-windows-sdk-root`
- `-windows-sdk-version`
- `-visualc-tools-root`
- `-visualc-tools-version`
Together these options make one the master of Windows SDK selection for
the Swift compilation. This is important as now that the injection is
no longer done by the user, we need to ensure that we have enough
control over the paths so that the synthesized overlay is going to map
the files to the proper location.
This is the second step towards removal of the content injection into
the Visual Studio installation. With this the new path is enabled to
create the mappings to the SDK shared content. Subsequent improvements
involve the introduction of new options to the Swift driver and
Swift frontend:
1. `-windows-sdk-root`
2. `-windows-sdk-version`
3. `-visualc-tools-root`
4. `-visualc-tools-version`
The introduction of these options will then feed into the path selection
here enabling granular control over the VCRuntime and Windows SDK by the
user.
Thanks to @artemcm for the very helpful discussion and help on
identifying a good set of options for the driver. Thanks to @stevapple
for the inspiration for this patch.
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`
The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.
rdar://102362022
`getToolChain()` and `AddClangSystemIncludeArgs()` don't parse the arguments to set the
sysroot, so set it directly instead. Also, remove a redundant check for a valid directory.
Fixes#60224
We should only be skipping VFS libc modulemap injection on Darwin and
Windows. Unfortunately, we cannot just use the isOSGlibc Triple method
because LLVM's sense of Glibc (does the platform _actually use_ glibc)
differs from Swift's sense of Glibc (does the platform use libc).
There may be other non-libc platforms that we should skip VFS injection
on but let's correct the conditional for now and other prs should add
those platforms as necessary.
This will fix modularization issues caused by the presence of Glibc and libstdc++ in a single context.
Some Glibc headers were getting hijacked by the libstdc++ module, and the decls in them were incorrectly determined to be a part of libstdc++. This caused compiler errors when trying to use those decls.
After this change, we will be able to reference Glibc headers directly from the module map, without using an additional header (`SwiftGlibc.h`).
This logic is going to be extended to inject the modulemap and the header of Glibc in addition to libstdc++. It doesn't depend on the rest of ClangImporter, so let's extract it to a separate file to make incremental builds and IDE features faster.