This patch canonicalizes the macOS versions in the availability, so that clang can treat macOS 10.16 availability as macOS 11 availability. The if (@available (macOS 10.16, *) checks still preserve their original version in the generated code to ensure that the software running on macOS Big Sur Beta 1 can still exhibits the expected runtime behavior for the 10.16 availability checks.
Details
Details
Diff Detail
Diff Detail
Event Timeline
| clang/include/clang/AST/ExprObjC.h | ||
|---|---|---|
| 1719–1721 | Any reason these functions aren't marked const? | |
Comment Actions
LGTM, after mine and Aaron's comments.
| clang/lib/Sema/SemaExpr.cpp | ||
|---|---|---|
| 19195–19211 | nit: The lambda returning an optional seems a little overkill here, e.g. seems this could just be: ObjCAvailabilityCheckExpr::VersionAsWritten Version;
if (Spec != AvailSpecs.end()) {
if (Platform == "macos") {
Version = ObjCAvailabilityCheckExpr::VersionAsWritten{
llvm::Triple::getCanonicalVersionForOS(llvm::Triple::MacOSX,
Spec->getVersion()),
Spec->getVersion()};
} else {
Version = ObjCAvailabilityCheckExpr::VersionAsWritten{Spec->getVersion(),
Spec->getVersion()};
}
} | |
Any reason these functions aren't marked const?