This is an archive of the discontinued LLVM Phabricator instance.

Use llvm::VersionTuple instead of manual version marshalling
ClosedPublic

Authored by labath on Jun 7 2018, 8:44 AM.

Details

Summary

This has multiple advantages:

  • we need only one function argument/instance variable instead of three
  • no need to default initialize variables
  • no custom parsing code
  • VersionTuple has comparison operators, which makes version comparisons much simpler

I think this touches a lot of code which is not very well tested, so I'd
appreciate it if you can double-check the transformations in the code that you
are familiar with.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Jun 7 2018, 8:44 AM
labath updated this revision to Diff 151484.Jun 15 2018, 3:41 AM

Fix a typo in netbsd code.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 18 2018, 8:10 AM
This revision was automatically updated to reflect the committed changes.

Just FYI, I just came across this patch while debugging strangeness in PlatformDarwin.cpp and unfortunately this patch isn't NFC. VersionTuple::tryParse() can deal with an optional third (micro) component, but the parse will fail when there are extra characters after the version number (in my case trying to parse the substring "12.0.sdk" out of "iPhoneSimulator12.0.sdk" now fails after this patch). I'll fix it and try to add a unit test ...