[PATCH] D120806: [clang-format] Recognize "if consteval".

Johel Ernesto Guerrero Peña via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 2 08:18:28 PST 2022


JohelEGP accepted this revision.
JohelEGP added a comment.

My few cases format consistently with the condition case:

  diff
  diff --git a/tests/integration/test.waarudo.io.dynamic.cpp b/tests/integration/test.waarudo.io.dynamic.cpp
  index be5a626..e1265b9 100644
  --- a/tests/integration/test.waarudo.io.dynamic.cpp
  +++ b/tests/integration/test.waarudo.io.dynamic.cpp
  @@ -21,7 +21,7 @@ public:
     }
   
     constexpr ~input_source() {
  -    if (std::is_constant_evaluated()) {
  +    if consteval {
         expects(input_byte == previous_input_byte);
       } else {
         std::ofstream{"test.waarudo.io.dynamic.previous.input.byte.txt"} << "waarudo::byte{'"
  @@ -37,7 +37,7 @@ public:
     [[nodiscard]] constexpr waarudo::output_bytes output() override { return {&output_byte, 1z}; }
   
     constexpr ~output_destination() {
  -    if (std::is_constant_evaluated()) {
  +    if consteval {
         expects(output_byte == previous_output_byte);
       } else {
         std::cout << std::bit_cast<char>(output_byte);
  diff --git a/tests/waarudo.test.utilities.cpp b/tests/waarudo.test.utilities.cpp
  index ed82b2b..f4ec8e3 100644
  --- a/tests/waarudo.test.utilities.cpp
  +++ b/tests/waarudo.test.utilities.cpp
  @@ -13,7 +13,7 @@ export template<auto F> concept constant_invocable = requires { typename std::in
   export using waarudo::expects;
   
   export constexpr void runtime(void (*const f)()) {
  -  if (not std::is_constant_evaluated()) f();
  +  if not consteval { f(); }
   }
   
   template<std::integral I, std::invocable<I> F> void visit_values(F f) {

Thank you.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120806/new/

https://reviews.llvm.org/D120806



More information about the cfe-commits mailing list