[libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

Joerg Sonnenberger via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 14:01:21 PDT 2016

On Mon, Oct 31, 2016 at 01:25:19PM -0700, Richard Smith wrote:
> We could alternatively control the language features based only on the
> selected language mode, and only use version detection to power a warning
> for the (currently fairly common, but becoming less so) case where the
> selected runtime library isn't new enough to implement the requested
> features. That would cause a bunch of scenarios to break when upgrading to
> clang 4.0, but at least the fix would be pretty clear.

Let's split this slightly. Ultimately, we need to have codegen flags to
control individual features that require support from the ABI
implementation or even just from the STL implementation. I can think of
three different ways to provide the default values:
(1) Language mode selection
(2) Driver logic based on the target
(3) Source controls like #pragma

The third option would serve mostly the same purpose as feature
detection based on some magic __version file, but it also would allow
non-libc++ implementations or -nostdinc use cases to get the same


More information about the cfe-commits mailing list