-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Conversation
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fantastic, thank you @graydon
@@ -1503,6 +1503,9 @@ ERROR(empty_version_string,none, | |||
WARNING(unknown_platform_condition_argument,none, | |||
"unknown %0 for build configuration '%1'", | |||
(StringRef, StringRef)) | |||
WARNING(likely_simulator_platform_condition,none, | |||
"plaform condition appears to be testing for simulator environment", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you tack on "; use 'targetEnvironment(simulator)' instead" ? That way, one doesn't have to look at the contents of the Fix-It to see what the fix is.
@@ -254,6 +262,13 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) { | |||
else | |||
addPlatformConditionValue(PlatformConditionKind::Runtime, "_Native"); | |||
|
|||
// Set the "targetEnvironment" platform condition if targeting a simulator | |||
// environmet. Otherwise _no_ value is present for targetEnvironment; it's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo environmet
81cc50b
to
94988a2
Compare
@swift-ci please test |
Build failed |
Build failed |
/// Get the identifier string from an \c Expr if it's an | ||
/// \c UnresolvedDeclRefExpr, otherwise the empty string. | ||
static StringRef getDeclRefStr(Expr *E) { | ||
if (auto *UDRE = cast<UnresolvedDeclRefExpr>(E)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I just mistaken, or shouldn't this be a dyn_cast
? cast
implies that this must succeed and will abort if the expression type is not a UnresolvedDeclRefExpr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, this is a typo, thanks! Will fix tomorrow.
This is an implementation of swiftlang/swift-evolution#764 which has now been accepted. It is ready to merge.