New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#if targetEnvironment(simulator) #12964

Merged
merged 4 commits into from Nov 29, 2017
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+19 −6
Diff settings

Always

Just for now

[Platform] Support triple.isSimulatorEnvironment()

  • Loading branch information...
graydon committed Nov 15, 2017
commit d3613b80175577315e18c142743734e7f6cd1cbc
Copy path View file
@@ -18,25 +18,37 @@ using namespace swift;
bool swift::tripleIsiOSSimulator(const llvm::Triple &triple) {
llvm::Triple::ArchType arch = triple.getArch();
return (triple.isiOS() &&
(arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64));
// FIXME: transitional, this should eventually stop testing arch, and
// switch to only checking the -environment field.
(triple.isSimulatorEnvironment() ||
arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64));
}

bool swift::tripleIsAppleTVSimulator(const llvm::Triple &triple) {
llvm::Triple::ArchType arch = triple.getArch();
return (triple.isTvOS() &&
(arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64));
// FIXME: transitional, this should eventually stop testing arch, and
// switch to only checking the -environment field.
(triple.isSimulatorEnvironment() ||
arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64));
}

bool swift::tripleIsWatchSimulator(const llvm::Triple &triple) {
llvm::Triple::ArchType arch = triple.getArch();
return (triple.isWatchOS() &&
(arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64));
// FIXME: transitional, this should eventually stop testing arch, and
// switch to only checking the -environment field.
(triple.isSimulatorEnvironment() ||
arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64));
}

bool swift::tripleIsAnySimulator(const llvm::Triple &triple) {
return tripleIsiOSSimulator(triple) ||
tripleIsWatchSimulator(triple) ||
tripleIsAppleTVSimulator(triple);
// FIXME: transitional, this should eventually just use the -environment
// field.
return triple.isSimulatorEnvironment() ||
tripleIsiOSSimulator(triple) ||
tripleIsWatchSimulator(triple) ||
tripleIsAppleTVSimulator(triple);
}

DarwinPlatformKind swift::getDarwinPlatformKind(const llvm::Triple &triple) {
@@ -1,4 +1,5 @@
// RUN: %swift -typecheck %s -verify -target x86_64-apple-ios7.0 -parse-stdlib
// RUN: %swift -typecheck %s -verify -target x86_64-unknown-linux-simulator -parse-stdlib
// RUN: %swift-ide-test -test-input-complete -source-filename=%s -target x86_64-apple-ios7.0
#if !targetEnvironment(simulator)
ProTip! Use n and p to navigate between commits in a pull request.