[libcxx-commits] [PATCH] D149554: [libc++][test] Selects proper C++23 field.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 4 08:09:10 PDT 2023
Mordante updated this revision to Diff 519505.
Mordante added a comment.
Rebased and addresses review comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149554/new/
https://reviews.llvm.org/D149554
Files:
libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
Index: libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
===================================================================
--- libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
+++ libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
@@ -25,6 +25,24 @@
return str.find("__") != std::string_view::npos;
}
+// Starting with Clang 17 ToT C++23 support is provided by CPlusPlus23 instead
+// of C++23 support is provided by CPlusPlus2b. To allow a smooth transition for
+// libc++ use "reflection" to select the proper member. Since the change
+// happens in the development cycle it's not possible to use #ifdefs.
+template <class T>
+bool CPlusPlus23(const T& lang_opts)
+ requires requires { T::CPlusPlus2b; }
+{
+ return lang_opts.CPlusPlus2b;
+}
+
+template <class T>
+bool CPlusPlus23(const T& lang_opts)
+ requires requires { T::CPlusPlus23; }
+{
+ return lang_opts.CPlusPlus23;
+}
+
std::vector<const char*> get_standard_attributes(const clang::LangOptions& lang_opts) {
std::vector<const char*> attributes = {"noreturn", "carries_dependency"};
@@ -43,7 +61,7 @@
attributes.emplace_back("no_unique_address");
}
- if (lang_opts.CPlusPlus2b) {
+ if (CPlusPlus23(lang_opts)) {
attributes.emplace_back("assume");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149554.519505.patch
Type: text/x-patch
Size: 1276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230504/7958c033/attachment.bin>
More information about the libcxx-commits
mailing list