This is an archive of the discontinued LLVM Phabricator instance.

Alternative solution for detecting libc++'s version.
ClosedPublic

Authored by EricWF on Oct 27 2016, 8:21 PM.

Details

Summary

This patch presents an alternative approach to adding a <version> header and including it from <config>.

Instead of using a <__version> header this patch adds a __libcpp_version *file* not intended for use as a header, and leaves _LIBCPP_VERSION unchanged. This prevents the additional cost of including <__version> from <__config>. To prevent _LIBCPP_VERSION and __libcpp_version from getting out of sync we static_assert that the values match when building the library.

Additionally this patch adds a _LIBCPP_LIBRARY_VERSION macro for reporting the version of the dylib used. This is unrelated to @rsmith's original patch but I've been meaning to implement it for a while.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 76162.Oct 27 2016, 8:21 PM
EricWF retitled this revision from to Alternative solution for detecting libc++'s version..
EricWF updated this object.
EricWF added reviewers: rsmith, mclow.lists.
EricWF added subscribers: cfe-commits, rsmith.
rsmith edited edge metadata.Oct 27 2016, 9:59 PM

This is perfect for my needs, thanks!

EricWF accepted this revision.Oct 27 2016, 11:19 PM
EricWF added a reviewer: EricWF.
This revision is now accepted and ready to land.Oct 27 2016, 11:19 PM
EricWF closed this revision.Oct 27 2016, 11:19 PM

r285382.