[Lldb-commits] [PATCH] D61233: Refactor ObjectFile::GetSDKVersion

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 29 01:22:42 PDT 2019

labath added a comment.

In D61233#1481527 <https://reviews.llvm.org/D61233#1481527>, @teemperor wrote:

> I decided to go for a vector because otherwise the implementation in ObjectFileMachO gets a bit awkward. But I have no problem with doing a VersionTuple instead and adding some manual translation to version tuple in ObjectFileMachO.

I think it would be better to use a VersionTuple, for consistency with other version uses. I don't see why the MachO implementation should be awkward because of that. You'd just need to replace the three `push_back` lines with `m_sdk_version = VersionTuple(xxxx, yy, zz);`. In fact, if at the same time you rewrite the `GetSDKVersion` into something like:

  if (m_sdk_version.empty())
    m_sdk_version = GetVersionFromLC_VERSION());
  if (m_sdk_version.empty())
    m_sdk_version = GetVersionFromLC_BUILD_VERSION());
  return m_sdk_version;

that code will become at least five times more readable than it is now. :)



More information about the lldb-commits mailing list