[PATCH] D26044: Factor out libc++ version file to allow Clang to more easily sniff for the installed version

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 27 15:25:57 PDT 2016


rsmith created this revision.
rsmith added reviewers: mclow.lists, EricWF.
rsmith added a subscriber: cfe-commits.
rsmith set the repository for this revision to rL LLVM.

Clang would like to enable some language-version-specific functionality only if the installed C++ standard library supports it (so far, sized deallocation and aligned allocation, but more cases are expected to follow). Right now, it's hard for the Clang driver to determine which version of libc++ it's found (this is typically easy for libstdc++, since the version is right there in the path).

The idea here is that the __version file is always a single-line file that simply defines the libc++ version, and Clang can determine the installed version by just reading this file. There doesn't seem to be a way to make the file contain only the version number, so it contains the relevant #define instead.


Repository:
  rL LLVM

https://reviews.llvm.org/D26044

Files:
  __config
  __version


Index: __version
===================================================================
--- __version
+++ __version
@@ -0,0 +1 @@
+#define _LIBCPP_VERSION 4000
Index: __config
===================================================================
--- __config
+++ __config
@@ -27,7 +27,7 @@
 #define _GNUC_VER 0
 #endif
 
-#define _LIBCPP_VERSION 4000
+#include <__version>
 
 #ifndef _LIBCPP_ABI_VERSION
 #define _LIBCPP_ABI_VERSION 1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26044.76115.patch
Type: text/x-patch
Size: 430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161027/b926ed09/attachment.bin>


More information about the cfe-commits mailing list