llvm-project/clang/test/Lexer/has_feature_experimental_library.cpp
Louis Dionne ca495e36c1 [clang] Add a new flag -fexperimental-library to enable experimental library features
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
2022-07-19 15:04:58 -04:00

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();