[libcxx-commits] [PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated
Takuya Shimizu via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 31 10:11:00 PDT 2023
hazohelet updated this revision to Diff 545707.
hazohelet added a comment.
Fixed libc++ tests (NFC)
There's no change in clang codes.
This change should not change the semantics of all relevant codes because this only replaces tautologically-false uses of `is_constant_evaluated()` with `false` through macros.
These tautologically-false uses in tests are in if-condition expression inside non-constexpr functions.
- Make `__libcpp_is_constant_evaluated()` in `libcxx/include/__type_traits/is_constant_evaluated.h` return `false` instead of `__builtin_is_constant_evaluated()` in pre-C++11 mode.
- Set `TEST_IS_CONSTANT_EVALUATED` macro to `false` in pre-C++11 mode.
- Remove all tautologically-false use of `TEST_IS_CONSTANT_EVALUATED` macro in tests by defining 4 more macros `TEST_IS_CONSTANT_EVALUATED_CXX{14, 17, 20, 23}` and replacing former use of `TEST_IS_CONSTANT_EVALUATED` with the corresponding one.
(Git diff context is not complete in order to fit within ~8MB patch file size limit of Phabricator)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155064/new/
https://reviews.llvm.org/D155064
Files:
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticASTKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/AST/ExprConstant.cpp
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseStmt.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/AST/Interp/builtins.cpp
clang/test/AST/Interp/if.cpp
clang/test/AST/Interp/literals.cpp
clang/test/CXX/expr/expr.const/p2-0x.cpp
clang/test/CXX/expr/expr.const/p6-2a.cpp
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p4.cpp
clang/test/Parser/pragma-fenv_access.c
clang/test/SemaCXX/constant-conversion.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp
clang/test/SemaCXX/cxx2a-consteval.cpp
clang/test/SemaCXX/cxx2b-consteval-if.cpp
clang/test/SemaCXX/cxx2b-consteval-propagate.cpp
clang/test/SemaCXX/vartemplate-lambda.cpp
clang/test/SemaCXX/warn-constant-evaluated-constexpr.cpp
clang/test/SemaCXX/warn-tautological-meta-constant.cpp
clang/test/SemaTemplate/concepts.cpp
clang/unittests/Support/TimeProfilerTest.cpp
libcxx/include/__type_traits/is_constant_evaluated.h
libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.segmented.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp
libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp
libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp
libcxx/test/std/algorithms/robust_re_difference_type.compile.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp
libcxx/test/std/containers/sequences/vector/access.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
libcxx/test/std/strings/basic.string/string.access/at.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp
libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.verify.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/release.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/swap.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/swap.pass.cpp
libcxx/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
libcxx/test/support/charconv_test_helpers.h
libcxx/test/support/constexpr_char_traits.h
libcxx/test/support/count_new.h
libcxx/test/support/test_macros.h
libcxx/test/support/unique_ptr_test_helper.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155064.545707.patch
Type: text/x-patch
Size: 141199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230731/6a25b258/attachment-0001.bin>
More information about the libcxx-commits
mailing list