This is an archive of the discontinued LLVM Phabricator instance.

Fix a bug PlatformDarwin::SDKSupportsModule
ClosedPublic

Authored by aprantl on Oct 24 2018, 3:23 PM.

Details

Summary

This fixes a bug PlatformDarwin::SDKSupportsModule introduced by https://reviews.llvm.org/D47889.
VersionTuple::tryParse() can deal with an optional third (micro) component, but the parse will fail when there are extra characters after the version number (e.g.: trying to parse the substring "12.0.sdk" out of "iPhoneSimulator12.0.sdk" fails after that patch).
Fixed here by stripping the ".sdk" suffix first.

rdar://problem/45041492

Diff Detail

Event Timeline

aprantl created this revision.Oct 24 2018, 3:23 PM
jingham accepted this revision.Oct 24 2018, 5:16 PM

Looks good to me.

This revision is now accepted and ready to land.Oct 24 2018, 5:16 PM
shafik added a subscriber: shafik.Oct 25 2018, 8:55 AM
shafik added inline comments.
source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
1405

Could we avoid C-style casts, and in this case use static_cast although in this case it is obvious, using explicit casts avoids bugs in the long-term due to changes in type and cv-qualifiers etc... and makes your intent clear.

I personally would advocate for -Wold-style-cast being a hard error in C++ code.

1408

Same comment here.

labath accepted this revision.Oct 29 2018, 3:38 AM

lgtm. Sorry about the trouble.

aprantl closed this revision.Dec 11 2018, 9:15 AM

Looks like this landed in r345274 and wasn't properly closed.