mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Frontend] Infer simulator environment in the frontend, too.
Some code paths that see target triples go through the frontend without seeing the driver. Therefore, perform the same "simulator" inference for x86 iOS/tvOS/watchOS triples also in the frontend, to ensure that we remain compatible. Also make sure that -print-target-info performs the appropriate adjustment.
This commit is contained in:
@@ -553,9 +553,22 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
llvm::Triple Target = Opts.Target;
|
||||
StringRef TargetArg;
|
||||
std::string TargetArgScratch;
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_target)) {
|
||||
Target = llvm::Triple(A->getValue());
|
||||
TargetArg = A->getValue();
|
||||
|
||||
// Backward compatibility hack: infer "simulator" environment for x86
|
||||
// iOS/tvOS/watchOS. The driver takes care of this for the frontend
|
||||
// most of the time, but loading of old .swiftinterface files goes
|
||||
// directly to the frontend.
|
||||
if (tripleInfersSimulatorEnvironment(Target)) {
|
||||
// Set the simulator environment.
|
||||
Target.setEnvironment(llvm::Triple::EnvironmentType::Simulator);
|
||||
TargetArgScratch = Target.str();
|
||||
TargetArg = TargetArgScratch;
|
||||
}
|
||||
}
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_target_variant)) {
|
||||
|
||||
Reference in New Issue
Block a user