From 466af2fc1fdeb87b12a6413aedec021798ec06a6 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 4 Sep 2025 23:17:27 -0700 Subject: [PATCH] [llvm] Use "static constexpr bool flow" in YamlIO.rst In C++17, we should use "static constexpr bool" instead of "static const bool" for class-scope constants for for better compile-time evaluation and checks. --- llvm/docs/YamlIO.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/docs/YamlIO.rst b/llvm/docs/YamlIO.rst index c5079d8f6c192..4f523cb28e097 100644 --- a/llvm/docs/YamlIO.rst +++ b/llvm/docs/YamlIO.rst @@ -807,7 +807,7 @@ Flow Mapping A YAML "flow mapping" is a mapping that uses the inline notation (e.g { x: 1, y: 0 } ) when written to YAML. To specify that a type should be written in YAML using flow mapping, your MappingTraits specialization should -add "static const bool flow = true;". For instance: +add ``static constexpr bool flow = true;``. For instance: .. code-block:: c++ @@ -824,7 +824,7 @@ add "static const bool flow = true;". For instance: ... } - static const bool flow = true; + static constexpr bool flow = true; } Flow mappings are subject to line wrapping according to the ``Output`` object @@ -859,7 +859,7 @@ Flow Sequence A YAML "flow sequence" is a sequence that when written to YAML it uses the inline notation (e.g [ foo, bar ] ). To specify that a sequence type should be written in YAML as a flow sequence, your SequenceTraits specialization should -add "static const bool flow = true;". For instance: +add ``static constexpr bool flow = true;``. For instance: .. code-block:: c++ @@ -869,7 +869,7 @@ add "static const bool flow = true;". For instance: static MyListEl &element(IO &io, MyList &list, size_t index) { ... } // The existence of this member causes YAML I/O to use a flow sequence - static const bool flow = true; + static constexpr bool flow = true; }; With the above, if you used MyList as the data type in your native data