Frontend: Don't append -target-min-inlining-target target to implicit module builds.

When performing an implicit module build, the frontend was prepending
`-target-min-inlining-target target` to the command line. This was overriding
the implicit `-target-min-inlining-target min` argument that is implied when
`-library-level api` is specified. As a result, the wrong overload could be
picked when compiling the body of an inlinable function to SIL for emission
into the client, potentially resulting in crashes when the client of the module
is back deployed to an older OS.

Resolves rdar://109336472
This commit is contained in:
Allan Shortlidge
2023-05-16 14:42:26 -07:00
parent 0594efc0ce
commit 0e7ad1e9a4
7 changed files with 175 additions and 43 deletions

View File

@@ -532,6 +532,18 @@ public:
DependencyTracker *tracker = nullptr);
};
struct SwiftInterfaceInfo {
/// The compiler arguments that were encoded in the swiftinterface.
SmallVector<const char *, 64> Arguments;
/// The string following `swift-compiler-version:` in the swiftinterface.
std::string CompilerVersion;
/// The tools version of the compiler (e.g. 5.8) that emitted the
/// swiftinterface. This is extracted from the `CompilerVersion` string.
llvm::Optional<version::Version> CompilerToolsVersion;
};
struct InterfaceSubContextDelegateImpl: InterfaceSubContextDelegate {
private:
SourceManager &SM;
@@ -558,8 +570,7 @@ private:
bool suppressRemarks,
RequireOSSAModules_t requireOSSAModules);
bool extractSwiftInterfaceVersionAndArgs(CompilerInvocation &subInvocation,
SmallVectorImpl<const char *> &SubArgs,
std::string &CompilerVersion,
SwiftInterfaceInfo &interfaceInfo,
StringRef interfacePath,
SourceLoc diagnosticLoc);
public: