
Based on the discussion at [1], this patch adds a Clang flag called -fexperimental-library that controls whether experimental library features are provided in libc++. In essence, it links against the experimental static archive provided by libc++ and defines a feature that can be picked up by libc++ to enable experimental features. This ensures that users don't start depending on experimental (and hence unstable) features unknowingly. [1]: https://discourse.llvm.org/t/rfc-a-compiler-flag-to-enable-experimental-unstable-language-and-library-features Differential Revision: https://reviews.llvm.org/D121141
11 lines
421 B
C++
11 lines
421 B
C++
// RUN: %clang_cc1 -E -fexperimental-library %s -o - | FileCheck --check-prefix=CHECK-EXPERIMENTAL %s
|
|
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-EXPERIMENTAL %s
|
|
|
|
#if __has_feature(experimental_library)
|
|
int has_experimental_library();
|
|
#else
|
|
int has_no_experimental_library();
|
|
#endif
|
|
// CHECK-EXPERIMENTAL: int has_experimental_library();
|
|
// CHECK-NO-EXPERIMENTAL: int has_no_experimental_library();
|