diff --git a/libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp b/libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp --- a/libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp +++ b/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 +bool CPlusPlus23(const T& lang_opts) + requires requires { T::CPlusPlus2b; } +{ + return lang_opts.CPlusPlus2b; +} + +template +bool CPlusPlus23(const T& lang_opts) + requires requires { T::CPlusPlus23; } +{ + return lang_opts.CPlusPlus23; +} + std::vector get_standard_attributes(const clang::LangOptions& lang_opts) { std::vector 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"); }